The Web Wizard's Guide to PHP

A good book for PHP beginners and their instructors.

Title: The Web Wizard's Guide to PHPAuthor: David A. LashPublisher: Addison-WesleyISBN: 0-321-12174-0

If you're looking to learn PHP or to teach a course on PHP, check out The Web Wizard's Guide to PHP by David Lash. This is an excellent book for learning PHP, even if you have no programming skills. If you're like me and have experience in another language, such as Perl, you'll find that Lash's book makes it easy to rapidly get up to speed in PHP. Although it's only a little over 200 pages in length, it's packed with all you need to get started with PHP and offered at a fair price.


The book explains PHP variables, how to pass them between web pages and PHP scripts and how to build expressions for pattern matching and data extraction. It covers the basics of arrays and associative arrays, and it shows practical ways to incorporate them into web design. It also explains the syntax for script flow controls (i.e., "if" and "else" statements, "for" and "while" loops) and provides useful examples of each. As for more advanced topics, Lash presents them in an approachable manner, including opening, reading, writing and closing files. He also goes over creating and using PHP sessions and cookies. The last chapter in this eight-chapter book provides basic instructions on writing PHP scripts to interface with a MySQL database and some related examples. Finally, several exercises are offered at the end of each chapter to reinforce concepts in depth.

Making Learning PHP Easier

When I spoke with Lash, he mentioned he took special care in preparing the example scripts in his book. He wanted to provide real-life examples that were clean and to the point. They involve order forms, inventory look-ups and some typical web functions, such as user comment forms that e-mail a webmaster. Lash, an adjunct professor at DePaul University in Chicago, said that he wanted the example scripts to be intermingled among the text to make learning PHP easier. "My students like that they can work through the examples without having to wade through a lot of text before being able to apply the concepts presented."

Good advice on coding style and documenting accompanies many of the examples, as do warnings concerning common mistakes that newcomers to PHP typically make and how to troubleshoot them. "Teaching evening courses to working adults at a liberal arts school definitely helped prepare me for writing this book", says Lash, who is also a software engineer at Lucent. Because of his experience working with non-technical students, he makes no assumptions about the reader's background in his book except that the reader has some familiarity with HTML. But this is not required when used in a class room setting. As such, he introduces PHP functions in a manner that shouldn't lose the beginner nor bore the more advanced programmer.

Because the book was made primarily for use in the classroom, it has a schoolbook feel to it. While you may find this book to be reminiscent of your middle-school days, please do not think this is a book for teenagers. "The book strives to have some of the easy-to-use qualities of those Visual computer books but with solid explanations and real-world examples useful to classrooms and software professionals", says Lash. "I wanted to provide simple, straightforward explanations with useful examples and syntax descriptions." The playful graphics and the color-coded scripts, which add to the schoolbook style, both disarm readers who have never learned a programming language and make studying the code easier. To further assist in picking apart the code presented in the book, incidentally, Lash provides line-by-line explanations of each script excerpt.

For Instructors

If you would like to make use of Lash's book for teaching a web design course, you can find instructor aides on Addison-Wesley's site for their Web Wizard series. Lash says, "I put in a lot of extra work on the course materials because I knew that I was going to use them for my classes."

The site provides PowerPoint slides (which can be opened in OpenOffice, by the way), sample tests, class handouts and instructor tips. To get access to these resources, including answers to the test questions and the exercises at the end of each chapter, you need to talk to an Addison-Wesley sales representative about setting up a free instructor account. Go to the web site mentioned above for contact information. By the way, several other books in Addison-Wesley's Web Wizard series (listed on the site) may be of interest to you, including another book by David Lash on Perl and CGI.