PHP: The Good Parts Book Review
PHP has come a long way since its introduction 15 years ago. What began as a means for PHP creator Rasmus Lerdorf to display his resume to prospective employers visiting his personal website has blossomed into what many refer to as the Visual Basic of the web. As a result of its lengthy and highly successful history, numerous books have been written about it. How does O'Reilly's latest addition, PHP: The Good Parts, compare to this vast sea of PHP content? Read on to find out.What initially struck me about this book compared to the dozens of other PHP books I have read was how short and concise it is. Entire books have been written solely on the individual topics found in PHP: The Good Stuff. While I initially suspected the book was nothing more than a 'Learn PHP in a Day' clone, reading beyond the first two chapters proved otherwise. Yes, this book is a rapid review of the key aspects required to construct a PHP-driven website, but its combination of focused choices made and the lean presentation it packs delivers a potent punch compared to other condensed PHP books on the market. This book isn't just a collection of cut and paste snippets from other sources. Rather, it is written by an experienced PHP developer for those new to PHP and for skeptics like me who scoffed at PHP's original mishmash of business logic and presentation layer. Competition from other more elegant frameworks as well as the ire of seasoned PHP developers have pushed more manageable framework abstractions onto the language, though none of these are explored in detail in the book. Its intent is to highlight the key aspects of what makes PHP so compelling to a vast audience of web developers willing to overlook its shortcomings.
The book starts off with the basics: data types, functions, strings and arrays. Objects are demonstrated in Chapter 6 and databases featuring MySQL make their mark in Chapter 7, followed by chapters covering email, PDF and report generation and PHP security (with special attention paid to the ever-prevalent cross-site scripting and SQL injection attacks). The final chapters cover PHP version 5.3 'Good Parts' such as namespaces, closures and the scary goto operator. The book concludes with a chapter covering regular expressions, SimpleXML, a sampling of PHP-capable IDE's (however, the choices of IDE's selected for the book was not as extensive or critical of their functionality and proposed value as I would have preferred) and suggested websites for interested readers to learn more. Commendably, the author includes an appendix on 'The Bad Parts', sharing the problems that PHP still plague developers with. Mad props to Peter for his courage to be honest with his audience.
Overall, Peter MacIntyre does something with PHP: The Good Parts that other PHP books often fail to do. He gets readers excited about PHP by showing how easy and quick it is to use and how powerful its libraries can be. In fact, the book motivated me to write a PHP mashup for an Arduino project I am working on with my daughter. I was originally going to use Rails but decided that doing so would add way too much overhead for the simple web page generation functionality I needed. I whipped up a working PHP solution in no time, proving once again that it's always a good idea to be open to using the best tool for the job at hand.
Title: PHP: The Good Parts Author: Peter MacIntyre Publisher: O'Reilly Media ISBN: 978-0-596-80437-4 Pages: 176 Cost: $29.99