REVIEW - PHP Cookbook


PHP Cookbook


David Sklar, Adam Trachtenberg



O'Reilly (2003)




Christopher Hill


April 2003



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.

Your Privacy

By clicking "Accept All Cookies" you agree ACCU can store cookies on your device and disclose information in accordance with our Privacy Policy and Cookie Policy.

By clicking "Share IP Address" you agree ACCU can forward your IP address to third-party sites to enhance the information presented on the site, and that these sites may store cookies on your device.