Channels ▼

Mike Riley

Dr. Dobb's Bloggers

PHP: The Good Parts Book Review

May 05, 2010

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

Related Reading

More Insights

Currently we allow the following HTML tags in comments:

Single tags

These tags can be used alone and don't need an ending tag.

<br> Defines a single line break

<hr> Defines a horizontal line

Matching tags

These require an ending tag - e.g. <i>italic text</i>

<a> Defines an anchor

<b> Defines bold text

<big> Defines big text

<blockquote> Defines a long quotation

<caption> Defines a table caption

<cite> Defines a citation

<code> Defines computer code text

<em> Defines emphasized text

<fieldset> Defines a border around elements in a form

<h1> This is heading 1

<h2> This is heading 2

<h3> This is heading 3

<h4> This is heading 4

<h5> This is heading 5

<h6> This is heading 6

<i> Defines italic text

<p> Defines a paragraph

<pre> Defines preformatted text

<q> Defines a short quotation

<samp> Defines sample computer code text

<small> Defines small text

<span> Defines a section in a document

<s> Defines strikethrough text

<strike> Defines strikethrough text

<strong> Defines strong text

<sub> Defines subscripted text

<sup> Defines superscripted text

<u> Defines underlined text

Dr. Dobb's encourages readers to engage in spirited, healthy debate, including taking us to task. However, Dr. Dobb's moderates all comments posted to our site, and reserves the right to modify or remove any content that it determines to be derogatory, offensive, inflammatory, vulgar, irrelevant/off-topic, racist or obvious marketing or spam. Dr. Dobb's further reserves the right to disable the profile of any commenter participating in said activities.

Disqus Tips To upload an avatar photo, first complete your Disqus profile. | View the list of supported HTML tags you can use to style comments. | Please read our commenting policy.