PHP The Good Parts book review
written by craig, 28 April 2010
Peter B MacIntyre’s PHP work had a lot to live up to. Few PHP developers adhere to solid development practices, and many will purchase this book on the strength of the title. However, the first shock is that it contains fewer than 150 pages — are there so few good parts to PHP?
The forward makes it clear that the book is aimed at developers who are new to PHP programming. The first 5 chapters cover installation, basic syntax, functions, strings and arrays. It’s a good introduction to the language, although those with some PHP experience will find little new.
I was more hopeful for chapter 6 — Objects. Unfortunately, just 12 pages are devoted to the topic, and 4 of those are dry code with little explanation or real-world application. The author recommends Peter Lavin’s Object-Oriented PHP (Amazon.com: $22.76, Amazon.co.uk: £23.99), but it’s disappointing not to have deeper analysis of the subject.
Chapter 7 covers database interaction using MySQLi and PDO. Bizarrely, 11 pages are devoted to SQLite and flat-file alternatives. Although these might be appreciated in a larger book, I wouldn’t consider them to be the ‘best parts’ of PHP, especially for large web applications.
Chapter 8 introduces us to PHP’s friends: email, PDF and graphic generation. The author devotes another 12 pages to dynamically-generated PDFs — useful, but not something PHP developers encounter on a daily basis.
The following chapters provide some reasonable security information and new PHP 5.3 features such as namespaces and closures. The goto statement also receives 2 pages, even though the author denounces it as a bad part of PHP?
The final chapter wraps up with brief details of regular expressions, string functions, SimpleXML, IDEs and websites. It’s useful, but there’s little you couldn’t find in greater depth within the PHP manual.
An appendix, named “The Bad Parts”, finishes the book. Another couple of pages are wasted on the goto statement and the register_globals directive — which has been disabled by default since v4.2.
On the plus side, “PHP The Good Parts” is well-written and easy to understand. It’s a concise introduction to the language which may be appreciated by developers with experience of other languages.
Unfortunately, PHP developers expect more and will feel misled by the title. O’Reilly has diluted “The Good Parts” brand.