Skip navigation.

Upgrading to PHP 5 by Adam Trachtenberg

I received this book in the post a few weeks ago. Here's a review:

One of the hardest types of books to write well are ones that describe technology upgrades, such as this book, Upgrading to PHP 5 by Adam Trachtenberg. The first problem is how much detail do you put in. Do you make it a complete introduction to PHP5, or stick only to the new bits? How do you convince people to buy your book, given the short shelf-life of such a book, and the large amount of free material on PHP5 the Internet? And given that no one has much experience with PHP5, what do you focus on?

The aim of the book is to educate PHP4 developers on the new PHP5 technologies. There is very little coverage of PHP4 here. I think Adam has done a good job on this book, with some reservations that I will cover later.

Adam clearly thinks that the main migration issues for PHP4 developers are learning Object-oriented Programming, and the two new database extensions for SQLite and MySQL 4.1. These are the first few chapters in the book, and take up the 1/3rd of the book. In other chapters he covers XML, SimpleXML, Iterators, Streams, and Error-handling (exceptions). More obscure stuff such as SOAP, Tidy and Reflection is covered in one chapter.

Even though I have read widely about PHP5, I still found this book a useful reference, because it delves deeper into the new features than most articles I have seen. I found the XML, Streams and Reflection coverage particularly useful; please remember that this is a reflection of my own ignorance, so you might find other chapters more useful.

Now about my reservations. Although the book covers the new technologies found in PHP5, in my opinion, there isn't enough coverage on managing and migrating existing PHP4 code to PHP5. In many situations, you need your code to work on both PHP4 and PHP5, with graceful degradation of functionality. This requires describing useful features such as PHP_VERSION, phpversion(), extension_loaded(), function_exists(); I could find no such references in the index, or the table-of-contents.

Given the above caveats, I feel that Adam has put a lot of work into this book and it deserves a reading if you are familiar with PHP4 and want to jumpstart learning about PHP5. It's available on Safari too.