Book review: PHP Cookbook by David Sklar and Adam Trachtenberg

This is a book review of PHP Cookbook by David Sklar, and Adam Trachtenberg.

Full disclosure: I received this book free under O’Reilly’s Reader Review Program.

This is a very comprehensive book indeed. I’m relatively new to PHP programming and I used this book in two different ways. Firstly, as a straightforward cover to cover read, and secondly, as a bit of practice and to make this review a bit more realistic, to help me write a little toy application that I am developing in idle moments in the hope that I can scale it up and use it in my job.

As an end to end read I found it very useful indeed and it has exposed me to hundreds of PHP functions and ways of working with PHP code. There are chapters on the fundamentals (objects, variables, functions) as well as on regex, security, working with RDMSs, testing and debugging, graphics, consuming and serving APIs, and more. Although the book is clearly useful for newcomers such as myself if you are a beginner be prepared to do a bit of reading outside of the book because (rightly so) there isn’t a lot of hand-holding so if you don’t understand the syntax you may struggle to keep up.

I’ve been working on a project to pull text from an API and automatically format it using HTML to highlight particular words and I used this book to help me progress with that. Various chapters were useful, from the humble beginnings of reading spreadsheets and iterating over values to the chapters on APIs, XML, and processing HTML with PHP. There were useful and clear recipes for each task that I wanted to perform and, caveats about background reading on syntax notwithstanding, I was able to easily change the code and use it within my own program.

I received the Kindle edition of the book, I’m afraid I can’t comment on the print version, but the Kindle version is an absolute dream. There is coloured syntax highlighting, a contents page with hyperlinks to the text always available in the menu, as well as hyperlinks within the text which point not only within the book but also to documentation on the internet. Finishing a recipe and then clicking straight through to another related one, or clicking to read online PHP documentation makes working with this book an absolute joy.

Overall this is an excellent read, I would recommend it to newcomers and experts alike.

Leave a Reply