If youre a PHP programmer like me, youve no doubt noticed that PHP 5 is starting to pick up steam. More and more hosting companies are starting to upgrade to PHP 5 and so I decided it was time to figure out just how this change would affect me and the code I had previously written in PHP 4. Luckily, Upgrading to PHP 5 by Adam Trachtenberg (co-author of the PHP Cookbook) comes to the rescue.
With the release of PHP 5 my first and foremost concern was with backwards compatibility with my old PHP 4 scripts. Will the new version run my old scripts and if so, how well? How much work is ahead of me to make sure my current scripts dont suddenly stop working? This turned out to be my only nit pick with the book because Adam only mentions PHP 4 compatibility mode in passing. While this book is about upgrading to PHP 5, I felt this was worth more than a glancing mention. Though Adam didnt spend any time on backwards compatibility, he did make sure to include instructions for installing PHP 5 along side PHP 4 so that you can get up to speed without losing all your old scripts. Aside from this minor sticking point Upgrading to PHP 5 doesnt disappoint.
Upgrading to PHP 5 managed to answer all my major concerns and provide plenty of side by side comparisons of the code. PHP 5 was a pretty major upgrade to the language and Adam covers the bases very well. The chapter on Object Oriented Programming was excellent and helped me get my head around a subject I often struggle with, me being a very procedural programmer. PHP 5 also had some fairly major updates to its MySQL and XML support, both of which Adam goes into great detail about. The most exciting part for me was MySQL sub-selects and transactions and Adam covers those well here.
What Youll Find
To give you an idea of what you will find in the book, here is a list of its chapters:
1. Introduction
2. Object-Oriented Programming
3. MySQL
4. SQLite
5. XML
6. Iterators and SPL
7. Error Handling and Debugging
8. Streams, Wrappers, and Filters
9. Other Extensions
10. PHP 5 in Action
A. Introduction to XML
B. Additional New Features and Minor Changes
C. Installing PHP 5 Alongside PHP 4
Index
The book had enough code examples to answer my questions, but if youre like me, I could have used more. I guess Ill have to wait for the PHP 5 Cookbook for that! Adam provides enough bits of code to show you what hes talking about and where applicable, he shows you the PHP 4 version of the code as well. This makes it very easy to see where changes are and just how easy the new way of doing things with PHP 5 really is.
Upgrading to PHP 5 isnt for beginners, though. If you dont know how to program and you dont have at least a working knowledge of PHP, this books is not for you. I would highly recommend you be proficient with PHP 4 before you pick up this book. However, if you are fluent in 4, this book wont let you down.
Upgrading covers the major differences in moving from PHP 4 to PHP 5 but Adam doesnt short change us with the little things either. In appendix B, Additional New Features and Minor Changes, Adam covers all the little things that have changed or have been added since PHP 4, which serves as a handy hit list of whats new or different. Appendix A, An Introduction to XML was also a nice bonus that I wasnt expecting. XML is growing rapidly and Adam gave it the proper space in this book.
Rating: 4/5
I am quite glad I picked up a copy of Upgrading to PHP 5 and I feel good about recommending it to you now. If youre looking for a guide to help you get up to speed on PHP 5 and you already know PHP 4 then this is the book youll want. Adam sticks to the OReilly formula and his knowledge of PHP is second to none.
Title: Upgrading to PHP 5
Author: Adam Trachtenberg
Publisher: OReilly