Been meaning to say this for a while now but George Schlossnagle’s book – Advanced PHP Programming is excellent. This isn’t meant as an extensive review but rather some thoughts, in reverse order to the books contents page…
– The coverage of Zend internals and extending PHP is the best I’ve seen (PHP has been badly in need of this) and was my reason for buying it. Not only is the “how” of extending PHP explained; there’s also detailed discussion of the Zend engine, the PHP execution lifecycle and so on, I believe based on George’s experiences with apd. Even if you’re not planning on writing your own PHP extension, there’s some valuable insight which can help influence the design of your PHP apps, particularly where performance is concerned. Knowledge of C is assumed (otherwise it would be a very big book), so be warned, but think George has succeeded in proving this misappropriation of the Tao Te Ching wrong (someone please kill it). While I’m on the subject of PHP extensions, there is another book, Building Custom PHP Extensions serves as a useful reference (probably not updated for PHP5 yet though) but lacks insight and explanations.
– Discussion of performance issues and scalability play a very big part, George having unique insight from sites he’s worked on. To an extent, I almost want to dispute the title – “High Performance PHP” might almost be better. As well as much open ended discussion of issues like caching, a significant part of this discussion looks at supporting technologies that help a site handle high traffic; finding them examined in a single book as part of a “big picture” is something else that makes the book special – even if you don’t work with PHP, it’s worth a read if you’re in position of having to run / develop web apps exposed to serious traffic. The bottom line is, again, it’s the only material of it’s kind right now for PHP. To get a taste of what to expect, it’s worth reading George’s recent article over on the Oracle Technology Network: Scaling Oracle and PHP.
– The first section of the book examines what I’d call “development practices” and where most talk of PHP itself happens – subjects like coding standard, OOP, CVS, unit testing and so on. George “dares” to use Smarty and PHPUnit, which probably won’t please everyone but the concepts are transferable.
The style of the book is discussion and “enablement” rather than step by step solutions. The chapter on caching, for example, never reaches “the answer” (is there one?) but provides looks and many different approaches and where / when they make a good choice.
It’s probably not a good place to begin coding PHP with unless you’ve already had experience of other programming languages. You may also find yourself all dressed up with nowhere to go, once you’ve read it (i.e. hunting for an employer with a high traffic site) but even if you’re not able to put everything it offers into practice, there’s a ton of ammo to fire back at that Java developer who makes snide remarks about PHP.