Review – PHP Cookbook
I started learning PHP a little over two years ago. After the first year, I started to run into some really interesting problems, such as searching a MySQL database for records between two dates, paging results, exchanging data between two sites with XML-RPC, two-way encryption of credit card information, and managing user sessions. Much of this took me the better part of a year to master. If I’d only had the PHP Cookbook back then, I could have used that time to be more productive!
I recently needed to update the system that powers my Website. I had to replace my user login system and I wanted to add a new level of encryption. I’d never used Blowfish encryption before, and I wanted a two way scheme so that I could recover passwords when my users forgot them. I was able to save myself quite a bit of time using the recipes in the PHP Cookbook that covered exactly what I needed.
Who Should Read This Book?
The PHP Cookbook should be on every PHP programmer’s bookshelf. It’s an excellent desktop reference that provides quick solutions to common problems.
Anyone who likes to learn by jumping in head first, and diving straight into code examples will be right at home with the PHP Cookbook. If you’ve read other books in the “Cookbook” series from O’Reilly, you’ll be familiar with the format: problem, solution, discussion.
What You’ll Find In This Book
The PHP Cookbook is broken into easy-to-reference chapters. Each of these comprises recipes that give you practical solutions to problems that you, as a PHP programmer, will face every day in the trenches.
The recipes get right to the meat of it. They describe the problem; show you the solution; and discuss how and why it was done. Here’s a look at the 21 chapters in this book:
- Dates and Times
- Classes and Objects
- Web Basics
- Database Access
- Web Automation
- Regular Expressions
- Encryption and Security
- Internationalization and Localization
- Internet Services
- Client-Side PHP
As you can see, there’s no shortage of topics! Each of the 21 chapters is broken into anywhere between 8 and 27 sections. The book covers plenty of basics — for example, the first few chapters introduce you to strings, numbers, arrays, variables and functions. The later chapters delve deeper into database access, encryption and security, regular expressions and services. Along the way, the authors manage to pack in practical examples for nearly any question to which you might need an answer.
To get a feel for the format of the book, you can check it out online. O’Reilly has published Chapter 8 on their Website.
What You Won’t Find
You won’t find cute anecdotes or witty quips in this book. You won’t find endless chapters filled with theory, nor evangelical diatribes about standards. This book wastes no time getting right down to the code.
The “Cookbook” series has managed to keep things concise and to the point, and leave out the personal stories from the authors, and the PHP Cookbook stayed true to this philosophy.
The Good …And The Bad
The PHP Cookbook managed to cover every topic I could have hoped for. But this isn’t a book from which the newbie could expect to learn PHP as a language. Instead, it’s devised to help you grasp tips and tricks that will greatly improve your code.
Some sections of the book failed to go into the detail I would have expected, while others droned on for too long. Luckily, these cases were the exception — not the rule. Like the other titles in the “Cookbook” series, you’ll find recipes collected from various books published by O’Reilly, so you’ll probably have seen some of them before. All in all, the good outweighs the bad.
I like learning by example, and the PHP Cookbook is chock full of them. Its sole aim is to provide code you can use right away, which will save you valuable time and allow you to concentrate on your other projects. To make things even easier, O’Reilly has made the code from all recipes found in the book available for download via the O’Reilly Website. You’ll also enjoy the book’s very thorough Index, which provides a quick and easy way to look up all the topics covered in the book.
I don’t know how I ever got along without this book. I’ve been very pleased with the PHP Cookbook and now find myself using it daily. That said, it’s not ideal for everyone. If you prefer lengthy explanations instead of code examples, this book probably isn’t your cup of tea. But if you are one of those people who prefers examples, this book is the one you’ve been looking for!
Title: PHP Cookbook
Authors: David Sklar, Adam Trachtenberg
Buy it at Amazon.com