PHP Cookbook by Adam Trachtenberg, David Sklar The following corrections were made to the 2/2003 reprint: Here's a key to the markup: [page-number]: serious technical mistake {page-number}: minor technical mistake : important language/formatting problem (page-number): language change or minor formatting problem (xvii) "XML-RPL" NOW READS "XML-RPC" (xx) Acknowledgments: "Thanks also our reviewers" NOW READS "Thanks also to our reviewers" (7) all comment lines in code; Spurious // HAS BEEN DELETED from the end of each comment line (75) "Chapter 4" was listed twice at the top of the page. This HAS BEEN CORRECTED. p. 93 - Recipe 4.11 the order of the parameters were also inversed for in_array, first code line under Solution: NOW READS: if (in_array($value, $array)) { p. 94 - Recipe 4.12 The order of the parameters of the function were inversed. array_search ($array, $value) NOW READS: array_search ($value, $array) [107] IN PRINT: Solution - line 4; array_intersection() NOW READS: array_intersect() (167) See Also: "Recipe 7.11 for defining a call dynamically" NOW READS "Recipe 7.12 for defining a class dynamically" {197, 198} IN PRINT: Recipe 8.19, Inside the pc_debug() function in the first code block of the Solution, inside pc_debug() in the first code block of the Discussion, inside pc_debug() and in the if()/elseif() statement in the last code block of the Discussion: "defined(DEBUG)" NOW READS: "defined('DEBUG') {244} Recipe 10.2 In the following code, the DBM handle was missing for dba_replace and dba_insert. The code at the bottom of page 244 NOW READS: $dbh = dba_open('fish.db','c','gdbm') or die($php_errormsg); // retrieve and change values if (dba_exists('flounder',$dbh)) { $flounder_count = dba_fetch('flounder',$dbh); $flounder_count++; dba_replace('flounder',$flounder_count, $dbh); print "Updated the flounder count."; } else { dba_insert('flounder',1, $dbh); print "Started the flounder count."; } The DBM handle was also missing in the code at the top of page 245; This code NOW READS: // what fish do we have? for ($key = dba_firstkey($dbh); $key !== false; $key = dba_nextkey($dbh)) { $value = dba_fetch($key, $dbh); => print "$key: $value\n"; } The DBM handle was also missing in the code at the bottom of page 246; This code NOW READS: // read in and unserialize the data if ($exists = dba_exists($_REQUEST['username'], $dbh)) { $serialized_data = dba_fetch($_REQUEST['username'], $dbh) or die($php_errormsg); $data = unserialize($serialized_data); } else { $data = array(); } The DBM handle was also missing for dba_replace and dba_insert, in the code at the top of page 247. This code NOW READS: // write data back to file if ($exists) { dba_replace($_REQUEST['username'],serialize($data), $dbh); } else { dba_insert($_REQUEST['username'],serialize($data), $dbh); } {265} IN PRINT: Recipe 10.12, The seventh line from the bottom of the page; printf('%s: , NOW READS: printf('%s: ', [326] code line before See Also; xslt_close() NOW READS xslt_free() [363] IN PRINT: code listing near the top of the page; mysql_connect('localhost',$_ENV['MYSQL_USER'],$_ENV['MYSQL_PASSWORD']); NOW READS: mysql_connect('localhost',$_SERVER['MYSQL_USER'],$_SERVER['MYSQL_PASSWORD']); [418] end of Example 16-1; Missing final } HAS BEEN ADDED. [430] IN PRINT: 8th block of code; $headers = $mime->headers($headers); $body = $mime->get(); NOW READS: $body = $mime->get(); $headers = $mime->headers($headers); [449] last paragraph ("See Also"); gethostbyaddrl NOW READS: gethostbynamel() {482} The very last line of the page: "passes it two arguments: 12 and 56." NOW READS: "passes it two arguments: 12; and 56."