Two Books on PHP

Phil Hughes

Issue #80, December 2000

While there has been a lot of web development in Perl, and Python is growing in this area, PHP is a tool designed specifically for dynamic web development.

  • Author: Julie C. Meloni

  • Publisher: Prima Tech

  • URL: www.prima-tech.com

  • Price: $39.99 US

  • ISBN: 0-7615-2729-X

  • Author: Tobias Ratschiller and Till Gerken

  • Publisher: New Riders

  • Price: $39.99 US

  • ISBN: 0-7357-0997-1

  • Reviewer: Phil Hughes

I chose to review these two books together because they complement each other. That doesn't mean they are the same quality—just that they cover different things in the same area.

Before you ask, “Why PHP?”, let me answer. While there has been a lot of web development in Perl, and Python is growing in this area, PHP is a tool designed specifically for dynamic web development. That, along with its C-like syntax, makes it an easy choice for a programmer wanting to add dynamic web content generation to their tool kit.

As a general comment about both books, they claim to cover PHP4. This is pretty much true because PHP4 is not very different from PHP3. This is actually good news because most existing PHP applications are still in PHP3, and a book that didn't cover PHP3 would be relatively useless.

PHP Essentials

This is the introductory book of the pair. It introduces PHP and works through many examples all the way to setting up an e-commerce site. Three of the eight chapters deal with databases in general and MySQL specifically. As the power of PHP comes from how it interacts with a database, this makes complete sense.

Once you get comfortable with what PHP is, the most important part of the book is the Essential PHP Language Reference in Appendix A. This appendix starts off with an introduction PHP syntax, and then covers all the built-in functions available to the PHP programmer. This section is well written and can act as a decent reference even for a newcomer to PHP.

When I finished reading this book, I felt I had the knowledge to go off and write some serious PHP code. Fortunately, instead of writing code, I read the other book.

Web Application Development with PHP 4.0

This book is the real winner of the pair. By that, I mean it goes well beyond my expectations for any book on any programming language. New Riders seems to be on a roll with their recent language books, as the last one I reviewed, Python Essential Reference, was also a winner.

This is not a beginning PHP book and certainly not a beginning programming book. In the introduction, they state that the target audience is PHP programmers who want to take their skills to the next level, know other programming languages or want to extend PHP's feature set. I think they are correct with this statement.

This book is organized into nine chapters, each designed to extend your knowledge in a particular direction. The first chapter deals with development concepts. With over 30 years of programming experience in a dozen or more languages under my belt, I immediately wanted to skip this chapter. Fortunately, they anticipated this and included a sidebar titled “Why You Should Read This Section”. Okay, they were right. Too often, we want to get to the fun part—writing code. This first chapter sets the whole tone for the book, showing us the significant benefits of doing the design work first.

The next chapter, titled “Advanced Syntax”, introduces concepts such as classes, which can be ignored in basic programming but make your life a lot easier when you get into serious development. Chapters three through five deal with application design presenting concepts you need to think about, with code to fill in the blanks. Not quick reading but clearly a good investment.

Chapter six gets into database access. Like PHP Essentials, this book also concentrates on MySQL, but the presentation is very different. PHPLib is introduced, and readers are shown how to develop an application that is database-independent. PHPLib adds a level of abstraction for other interfaces as well as the database, and this chapter convinced me that using this library can amount to huge savings in development time.

Chapter seven goes on to use PHPLib to develop a knowledge repository. Note that all this code is on the included CD along with PHP, MySQL, Apache, TurboLinux, PostgreSQL and even the entire book as a PDF document. This chapter also includes an overview of XML and how it can be used to benefit the developer.

Chapter eight presents some PHP success stories, useful information that could also be used to convince your boss that PHP is real and does solve real problems. The final chapter shows how PHP can be extended.

Conclusions

If you are doing serious PHP development, Web Application Development with PHP 4.0 is essential. It will make the difference between “my program finally works” and “I feel good about my program”. PHP Essentials, while not a great book, offers needed information to get you up to speed. What's missing in sophisticated programming is made up for in terms of the ease at which it can be read and its value as a language reference.

Phil Hughes is the publisher of Linux Journal.