Book Review: PHP: The Good Parts by Peter B. MacIntyre

PHP: The Good Parts, by Peter B. MacIntyre, O'Reilly 2010

When I first read this title, I had my doubts. Could a book that purported only to cover the "good parts" of a language really do justice to the language? Or would it be like telling your kids only about the "good parts" of sex, not mentioning the risks and responsibilities that go along with sharing intimacy? After reading the book, I'm impressed with the book and its approach. The book is good enough and substantive enough in its 150+ pages to get someone new to PHP both excited about the language and coding some useful PHP applications in short order.

Yes, the book is only 156 pages including the index. Yet it's not trying to ram the reader through PHP basics in a day or two. Instead, it carefully selects a series of the language's most critical and useful features and shows the reader how to make use of them.

PHP: The Good Parts covers data types; expressions; if else, switch, while and for statements; cookies and sessions; using the $_GET, $_POST and $_REQUEST superglobals (basically arrays); functions; strings; arrays; objects; database interaction; PDF generation and charts; PHP security; namespaces, closures and gotos, etc.; regular expressions and more. And, of course, it illustrates how to integrate PHP into web pages -- with great ease and remarkable success.

That's a lot of topics to cover in 150+ pages, especially to cover them, especially to cover them well. Each chapters shows not just what these features represent,but how to use them well.

It also includes a quick "bad parts" appendix covering such topics as why gotos should only be used when you really know what you're doing and how the inconsistency of function naming conventions can trip you up.

All in all, I found this book to be a quick read and a great resource for anyone who wants to try out PHP without investing a lot of time. It will show you what the language can do, help you do it and leave you with an accurate assessment of how the language is best used. It's well worth the time it will take you to read it and the $29.99 you'll have to invest.

This article is published as part of the IDG Contributor Network. Want to Join?

Computerworld's IT Salary Survey 2017 results
Shop Tech Products at Amazon