PHP Phrasebook — the 5 Minute Review

PHP Phrasebook“Look Mom, a PHP book without a chapter on design patterns”. Yup, you heard me right, the PHP Phrasebook goes back to the basics of PHP with a focus on functionality, simplicity and security, things which seem to unpresent in a lot of books these days.

The PHP Phrasebook is the first installment of a new series from Sams, which ca only be described as “a Cookbook in a Nutshell”. The book itself is small enough to fit in your back pocket and thick enough (278 pages) not to be totally ruined when you sit down. The book belongs to the Developer’s Library series, and has the same look and wonderful binding.

The Chapters are as follows:
1. Manipulating Strings
2. Working with Arrays
3. Date and Time (I’d never heard of date_sunrise() before)
4. Interacting with Web Forms (including good security tips and best practices)
5. Remembering Users (Sessions)
6. Using Files on the Server File System
7. Making Data Dynamic (Database access, including coverage of PDO)
8. Using XML (XML in both PHP4 and PHP5, SimpleXML and DOM)
9. Communicating with others (Sockets, SOAP and a rant on AJAX)

As expected, each chapter covers various common tasks (phrases) associated with the subject. Each chapter ends with a “What does PEAR Offer” text box which explores the possibilities using PEAR libraries. The content is very up-to-date, discussing the upcoming PHP5.1 release and functionality which will be available in it. There are also many “links” to external websites and pages which explain or are sources of additional information on the topic.

The lists of “phrases” within the chapters are not extensive, but a very systematic approach has been taken so that the code is as functional as possible. One example of this is the choice to instead of quoting a regular expression as a way to validate the syntax of an email address, a couple very simple checks are made to verify that the email address string contains the correct elements. This functional approach to problem solving is exactly what makes PHP a great language for people to pick up and learn.

Another focus is on security. In chapter 3 a routine for removing magic_quotes was developed, and then in each “phrase” where external data is being handled that routine is included and called. This may seem redundant, but there is no point including incomplete “phrases” when trying to learn a language, so while the extra space (just one include_once() call) is a bit annoying, I am very happy with the choice to include it. You will also notice that no data is displayed without being run through htmlentities() first.

The only problem I had is the fact that due to the size of the book, often the example code samples are awkward or break in difficult places. However, I am very pleased with this book in general and would recommend it to anyone who is coming to PHP from another Programming language or just starting with PHP as their first language.

I’m looking forward for the upcoming Apache and MySQL Phrasebook. What about a PHP SPL Phrasebook?

11 Responses to “PHP Phrasebook — the 5 Minute Review”

  1. Tov Says:

    dude- where do you archive your podcasts? how about a simple link like http://www.wormus.com/aaron/podcasts/

    duh!

  2. Gabriel Says:

    How’d you get my link? I just got it online an hour ago. I don’t think someone would have clicked on you and logged a referral…

    BTW, that book looks great. In working with some RSS/Atom code I soon discovered the sharp difference between PHP4 and 5’s specs… Good to know.

  3. iTJDkorqJa Says:

    Hi! Very nice site! Thanks you very much! JziIIPZXo3JcH

  4. iimvjireez Says:

    uxbzzbp

  5. Newark Says:

    Buy bargain deal online medications here - I can recommend it!

  6. Welcome Bonuses Says:

    Your website is beautifully decorated and easily navigated. I have enjoyed visiting this site today and hope to visit many more times in the future.

  7. trpgmplxzm Says:

    iivgscu

  8. ssfkoawzzw Says:

    Hello! Good Site! Thanks you! ibkaxuaezg

  9. mortgage louisville Says:

    check this out!

  10. credit cards for people with no credit Says:

    The stuff on this web site is really witty and cool wise

  11. debt consolidation lender Says:

    This site is interesting as well as informative. Enjoyed browsing through the site. Keep up the good work. Greetings..

Leave a Reply