Errata

Programming PHP

Errata for Programming PHP

Submit your own errata for this product.

The errata list is a list of errors and their corrections that were found after the product was released.

The following errata were submitted by our customers and have not yet been approved or disproved by the author or editor. They solely represent the opinion of the customer.

Color Key: Serious technical mistake Minor technical mistake Language or formatting error Typo Question Note Update

Version Location Description Submitted by Date submitted
PDF, Mobi Page 47
Example following 2nd paragraph

Just may be me, but the example and explanation make no sense.
Even ignoring the <?= tag (what is that?)
The example appears to be a no-op.
I am familiar with the similar construct in the c language.


<a href="<?= $url; ?>"><?= $linktext ? $linktext : $url; ?></a>

If text for the link $url is present in the variable $linktext, it is used as the text for
the link; otherwise, the URL itself is displayed.

Anonymous  Dec 08, 2014 
PDF Page 66
paragraph 4

I may just be misunderstanding this, but discussing the limitations of nested function declarations the book categorically states "Nested declarations do not limit the visibility of of the inner-defined function, which may be called from anywhere in your program" but two sentences later it says the inner function cannot be called from code parsed after the outer function.

This seems contradictory.

Anonymous  Sep 15, 2014 
Printed Page 112
First para after header "Matching"

The second sentence of this paragraph begins "The preg_match() function takes the same arguments and gives the same return value as the preg_match() function..."

Well, obviously it takes the same arguments etc as itself. Presumably one of those "preg_match"s should be something else, but I'm rather new to PHP and can't work out what it should be.

Is it possible that previous edtions were referring back to functions like "ereg" which are now deprecated or removed?

Ron Mitchell  Nov 14, 2018 
Printed, PDF, ePub Page 134

Notice: Undefined index: submitted in 05_03.php on line 10

The index "submitted" is not created until the form is submitted. Testing if it's set, or if it exists first gets rid of the notice.

if($_POST['submitted']) {...

Anonymous  May 20, 2015 
Printed Page 136
Example 5-3

The function is defined as userSort()
but the callback is $sortType($values,"user_sort").

The second parameter should be userSort().

Anonymous  Sep 26, 2016 
PDF Page 158
chapter6.Object,traits

code:
class UserGroup{
use Logger;
public $users = array();
public function addUser(User $user){
if (!$this->includesUser($user)) {
$this->users[] = $user;
$this->log("Added user '{$user}' to group");
}
}
}
run in the web page:
Fatal error: Call to undefined method UserGroup::includesUser().
Where is the mhthod includesUser()?

Blue  Jun 28, 2015 
Printed Page 188
entire script

check if the POST fields are set first before use, otherwise you get a whole load of error Notices.

Anonymous  May 20, 2015