KillerSites Blog

Book Review: PHP Cookbook 2nd edition

October 17, 2006

The ‘cookbook’ series from O’reilly press target a reader who understands (at least) the basics of a subject, these are not good books for beginners. This is the 2nd edition and covers PHP 5.

PHP Cookbook presents PHP by task rather than by language construct. For example:

  • Accessing Substrings
  • Controlling Case
  • Parsing Comma-Separated Data
  • Taking String Apart

The above list is taken from chapter 1 on strings. You’ll notice that there are no function names listed, but rather string related tasks.

That style of organising and presenting the material by common task, makes ‘PHP Cookbook’ very handy for any PHP programmer.

In my experience as a web developer, there have been many times when I would have a task to preform but wasn’t exactly sure how best to handle it … a book like this allows you to flip around and find what you need.


Besides showing how to preform common tasks with PHP, PHP Cookbook also does a good job discussing PHP concepts and aspects about the language – for example:

What is the difference between ereg and preg?

We learn that preg works more like Perl regular expressions, where the function also needs delimiters – you will have to get the book to learn more!


Each recipe is broken down into three subsections:

  1. Problem – a simple statement of what we are trying to do.
  2. Solution – a concise code snippet (usually) doing what we need to do.
  3. Discussion – shedding more light on the subject at hand.


I like the ‘cookbook’ series of books. If you are a PHP programmer, I know this is a book you probably should have sitting on your desk.

Stefan Mischook