PHP 5 in Practice is a PHP recipe book from Elliott White III and Jonathan D. Eisenhamer. Its most recent printing was in 2007 and is part of the “Developer’s Library” series from Sams Publishing. At 456 pages in length, this book is a bit shorter than some of the other books I have reviewed over the past several months. I have become a big fan of the Developer’s Library series and been pretty happy with all of the ones I have purchased so far. I have yet to find one book from that series that has really let me down so if you ever see one of these purple books, give a good hard look and see if perhaps it is something you would be interested in.
This book has been in my library for the last couple years and I still find it just as relevant today as the day I bought it. The recipes in this book are timeless and cover a lot of different areas of interest including: time and date functions, form handling, text manipulations, file handling, validation of user inputted data, XML manipulation and more. This content is displayed elegantly on decent quality paper and has a nice flow of content. Listings of code are properly set off with the typical teletype font and easily distinguishable from ordinary descriptive text.
I found the sections involving validation and email particularly useful for me and even worth putting versions of the recipes in my own set of ready-to-go functions. Some of the functions that you would think are the easiest are sometimes the hardest to nail down and this book does a great job of making simple to understand and implement code snippets for these types of tasks.
Being that this book is climbing in years some of the examples could definitely use some updating to take advantage of the advancements in PHP. But despite this, the book still has a lot of quality recipes that should work adequately with new development… well except for the sections dealing with databases. We will cover this problem now.
You have to recognize that this book was written with what it had available back in the day of 2006/2007. This was a time before things like PDO took over the PHP database interaction scene and becoming the dominate force of anti-sql injection techniques. So some of the examples, primarily chapter 14 starting on page 294, has code which is using mysqli_ functions and string escaping where you would now probably be using PDO classes to bind parameter values to a query. Keep this in mind when using some of the recipes from this book in current day development. They do cover PDO in a limited fashion but only after they show some of the older techniques, which should have probably just been left out of the book altogether. Perhaps they left them in just to cover their bases with legacy systems?? I can only guess.
Another issue I had with the book is the one you always have with recipe books, you simply are left wanting more. You find that recipe that is almost what you need but just slightly off. Sometimes you can rewrite the current recipe to handle what you like but sometimes it requires a whole new recipe. Each topic area has a handful of recipes and then moves on always making you feel like there was just not enough to sink your teeth into.
This book is one where if you can grab it on the cheap, do so but I wouldn’t suggest paying the full retail price. My best advice would be to grab it for $20 bucks on your Kindle and be done with it. It makes a nice little addition to your PHP recipe library and can help beginners specifically grow into an experienced developer by providing some real good examples of code functionality. Just don’t expect it to be the only book you need or even one that is exhaustive. It gives you only enough for a taste of what is possible with the language.
Thanks for reading! 🙂