Bookshelf: PHP Cookbook

← back to the blog

Most negative reviews of programming books are written by people the book is not for. So let's get that out of the way, first.

  • This book is not an introduction to programming.
  • This book is not an introduction to PHP.
  • This book is not for people who hate PHP or think it's not a "real" programming language.
  • This book is not the PHP Manual.

    "Cookbooks" represent something in between the manual and an overview of the language. Certain use cases for PHP are covered in enough detail to someone moderately familiar with the language a jumping-off point to get more information. For example, did you know:

  • You can chain PHP methods, just like in JavaScript? Eg. $orange = $fruit->;get('citrus')->;peel();. See page 207.

  • You can sort non-standards-compliant HTML with a single, built-in PHP function? See page 419.
  • How to serve a RESTful API (without a library) that accepts all the right methods and returns the correct response codes? That's chapter 15.
  • How to use the command line to test bits of code? That's Chapter 26.

This is a long book, and it's not meant to be read cover-to-cover, nor is it meant to be a replacement for the manual. It is not exhaustive. One disappointment for me what that lots of new stuff was not covered. PHP5 includes (and will include) features like namespaces, anonymous functions, and promises that are standard in other languages but are opening up whole new design patterns to PHP developers. That would have been perfect for the format of this book but was not included. Hopefully they'll appear in the fourth edition.