Product Overview

The PHP Anthology: 101 Essential Tips, Tricks & Hacks, 2nd Edition

Corrections & Typos

Found a mistake that’s not listed here? You clever monkey! Contact us to let us know!

  • No known errors at this time

Confirmed typos in the Feb 2008 update:

  • p.360, code listing

    In public function gc($ttl):

    Line 3 should be:

    $end = date('Y-m-d H:i:s',time()-$ttl);

    (Otherwise $end is in the wrong format for the sql statement.)

    Line 8 should be:

    $stmt->execute(array(':end'=>$end));

    Thanks to Dave Archbold

  • p.91, 1st code listing

    Validate::URL has been made obsolete in favor of Validate::URI

  • p.112, 2nd and 3rd code listings

    in the SQL statements DAYS should be DAY

Confirmed typos in the Nov 2007 print of the 2nd edition:

  • p.62, solution

    The solution and footnote refer to the method "listInsertId", when the correct name is "lastInsertId". The code listing and discussion paragraph have it correct, though.

  • p.78, 2nd code listing

    The first example outputs 2 copies of the first name when the intention was to output the first and last name. The code should read:

    echo "Hello {$user['first_name']} {$user['last_name']}";

  • p.308, code listing

    The following line should be removed:

    $result = $stmt->fetch();

  • p.333, 1st code listing

    We need to also store the digest of the new password in the session so it'll match the one stored in the database. The code should read:

    $auth->storeAuth($session->get($var_login), md5($newPassword));

  • p.345, 1st code listing

    The code should read:

    class User
    {
      protected $db;
      protected $cfg;
      protected $userId;
      protected $firstName;
      protected $lastName;
      protected $email;
      protected $permissions;

  • p.348, 2nd code listing

    The following line is repeated twice, one can be removed:

    $this->permissions = array();

  • p.422, 2nd code listing

    The method call is missing a closing parenthesis, it should read:

    $client = new SoapClient($uriToWsdl, array(
      'location' => $uriToSoapService,
      'classmap' => array('Book' => 'MyBook')
    ));
  • p.424, 2nd code listing

    This only applies to the PDF version of the book downloaded within the first week of its release. The error is corrected in the print version of the book and the current PDF version. This was previously inaccurately reported for page 422.

    The method call is missing a closing parenthesis, it should read:

    $server = new SoapServer($uriToWsdl, array( 
      'encoding' => 'ISO-8859-1', 
      'actor' => $uriToSoapService, 
      'classmap' => array('Book' => 'Book') 
    ));


ebook only

Instant Download!
This title available in Adobe PDF, Kindle (mobi) and ePub (IOS) formats

SitePoint Books

  • advocate best practice techniques
  • lead you through practical examples
  • provide working code for your web site
  • make learning easy and fun

100% Money Back Guarantee