Core PHP Programming: Using PHP to Build Dynamic Web Sites
Author: Leon Atkinson
Publisher: Prentice Hall
Price: $39.99 US
Reviewer: Allen Riddell
The word “coattails” often comes up in political races, describing situations where a popular candidate, usually a presidential one, can carry other members of his party into office on the basis of his popularity—on his “coattails”. Such an analogy fits this year well. Instead of a year of elections, we have a year of Linux and Open Source, each carrying a wide array of programming languages and applications into the mainstream through association.
One language of note riding the Penguin's wake is a web scripting language called PHP that has gathered users at an impressive rate. PHP competes against a sea of languages used to generate “dynamic web pages”--pages that consist partly or wholly of code and are interpreted every time they are viewed. Rival languages include Microsoft's Active Server Pages (ASP), Allaire's Cold Fusion and even Perl. More established competition would be hard to find.
PHP's popularity is further evidenced by sales of the book Core PHP Programming by Leon Atkinson, one of the few available books on the language. The book, having already sold out of its first printing, has placed consistently in the bestsellers at the on-line computer book retailers. And, according to Atkinson's web page, a second edition is being considered.
With only one PHP book available, such popularity might be attributed to the subject rather than the quality of the book. In this case, PHP might as well be BASIC, for Atkinson's writing stands among the best in the expanse of computer books, bucking the trend of quantity over quality that plagues so many thousand-plus-page books. Atkinson's writing is uncommonly concise and comprehensive.
Atkinson begins sensibly with an introduction to the language, detailing its advantages over the competition. With something as intentionally transparent as a web scripting language, such discussion is vital. Surfers have little chance of knowing which sites employ any web scripting language. For instance, the popular software site for Linux, freshmeat.net, uses PHP exclusively, although users cannot detect it viewing the opening page. Atkinson advocacy is traditional for open-source software, arguing that it beats the competition in price and flexibility—notably, it can be modified freely and distributed.
PHP's introduction and language basics comprise the first of four sections in the book. The introduction is quite rudimentary, suitable for complete beginners to programming. Variable declaration and other important but introductory topics are discussed exclusively in the opening section. For many—if not most—readers familiar with Perl, a language that bears substantial similarity to PHP, drifting through basic concepts like type casting and for statements to find the key differences between languages may be frustrating. A section or two comparing PHP and Perl would have been nice. It is, however, not too problematic, as most readers will soon become familiar through examples or reference sections if they do not slog through the opening chapters.
Atkinson calls the second section a “functional reference”, combining a traditional function reference with detailed examples on each function. Despite the redundancy of nearly identical functions and examples for SQL database calls in MySQL, mSQL and PostgreSQL, the design serves another purpose. By giving an example with each function, Atkinson allows the reader to learn by example. Such instruction should suit the type of programmer who is familiar but not proficient with the language, assuring him with each example that he is using both the function and related functions correctly. And while the reference does take up the majority of the book, Atkinson keeps examples brief but useful.
For beginning users, the third section, entitled “Algorithms”, provides an interesting path for readers, building from stable searching and sorting methods like bubble and quick sort, to more functional examples like retrieval from SQL databases. Such a design may strike more advanced users as somewhat silly, since no need for a bubble sort exists when using SQL or most other databases commonly accessed by PHP. Indeed, actually using PHP to sort a large database would be inadvisable—such a scheme would essentially entail compiling and executing code to sort the database every time a browser viewed the page. While parts of the chapter do seem better suited for an introductory computer course, struggling users may find familiar computer-science algorithms implemented in PHP helpful.
In the final section, Atkinson shines, taking the crucial step away from teaching the language to applying it in real-world examples and advising how to make the language a true alternative to the heavyweights of ASP and Cold Fusion. He calls the section “Software Engineering”, in reference to the increasingly popular term “Web Engineer”--comparing the construction a programmer does to that of a civil engineer. Discussing issues of design, efficiency and debugging, Atkinson outlines the important aspect of using PHP, doing useful things with it, namely building web sites.
For his part, Atkinson has done a wonderful job. His precision and organization makes reading and learning PHP simple. What should concern those interested in PHP is not how to learn it—Atkinson has solved that problem—but where PHP, the language itself, is headed. As with many open-source applications, PHP is evolving quickly. One rather drastic change currently taking place is a rewrite of the underlying “engine” of PHP. The project to do so is called “Zend” and also involves a licensing change. While the promise of backward compatibility exists, the prospect of new and better functions or methods of coding looms. For some, this may be a reason to use caution; for others, another reason to start learning the language.
PHP's future is bright. Atkinson's book is an excellent companion for anyone interested in learning a promising language—fast growing coattails of its own.
Allen Beye Riddell (email@example.com) currently attends Stanford University and has worked as a technology consultant for two years. PHP has been his language of choice for the past year—running on a Linux server, of course.