REVIEW - PHP Cookbook

Title:

PHP Cookbook

Author:

David Sklar, Adam Trachtenberg

ISBN:

1565926811

Publisher:

O'Reilly (2003)

Pages:

608pp

Reviewer:

Christopher Hill

Reviewed:

April 2003

Rating:

★★☆☆☆

The book is aimed at PHP programmers who have a basic understanding of the language, although some of the chapters cover material that I would have considered basic (i.e. chapters on Strings, Numbers and Arrays). Each 'recipe' or code snippet is presented as the solution to a problem, which is followed by a discussion which highlights the relevant points and concludes with a 'See Also' which often refers to the PHP online manual.

Sometimes the Problem - Solution - Discussion format does not help the subject matter, e.g. Problem 'I want to use a trigonometric function' - Solution use sin(), cos(), tan(). At other times the solution does not at first appear to match the problem, e.g. Problem - 'You want to replace the 3rd record in a file of 80 byte records, so you have to write starting at 161st byte'. Solution - fseek($fh, 26);.

Most of the code is presented as one or two liners, with lots of description. There are some code examples that run over a number of pages. These tend to demonstrate the features already described, thus providing useful reinforcement and a practical programme. Thankfully there are very few screen shots and other fillers.

This is not a book that you would read cover to cover and indeed the authors advise against this. There are twenty chapters, with topics as diverse as XML, form handling, Objects, Regular Expressions, encryption and PEAR. The large code examples are well structured and practical.

Many similar examples appear in many other PHP books - so if this were only your 2nd or 3rd PHP book, it would be recommended, otherwise view a copy and ask yourself if it answers questions you have.


Book cover image courtesy of Open Library.