Beginning PHP4

Beginning PHP4Thanks to programmer-friendly syntax and a groundswell of community support, PHP has grown in popularity to rival its competition in the server-side scripting arena, which includes Perl, ASP, Cold Fusion, and JSP. While PHP was designed to be a language that presents a familiar face to developers experienced in languages like C and Perl, PHP is also relatively easy for beginners to learn from scratch. Nevertheless, people with little or no programming experience will benefit greatly from a guided tour of the language to get them started, which is precisely what “Beginning PHP4″ from WROX Press provides.

After a helpful, well-illustrated chapter covering the installation of the components required for PHP development (PHP itself and a Web server configured to use PHP), the book guides the reader through the basic concepts of server-side scripting on the Web and proceeds through a discussion of the basic features of the PHP language: statements, variables, and data types. The only assumed knowledge in this book is the creation of basic Web pages with HTML, and every concept is supported by a practical example to help avoid any confusion.

Subsequent chapters explain the essential features of PHP, including: processing HTML form submissions, using some more advanced language constructs, keeping PHP code tidy to avoid unnecessary typing, and the all-important debugging of PHP programs. With the essential elements of the language covered, the book presses on with more advanced language features (from cookies to sessions, from object-oriented programming to file handling), always with a task-oriented approach supported by hands-on examples that allow the reader to pick up essential programming techniques. As a result, this book teaches the reader how to use PHP to get results, even if it means missing out on some subtle details of the language. Emphasis is placed on breadth of coverage of “hands-on” information, rather than on in-depth investigation of the technical details. This is especially appropriate to the less technically minded reader who mainly wants to know how to get things done.

Composed of what are arguably the three most important chapters of the book, “Beginning PHP4″‘s treatment of database connectivity continues in the same vein. By introducing the reader to a few concepts and then diving into a practical example, coming up for air again when a few more new concepts must be introduced, the authors manage to present a fairly complete overview of the technical issues and programming techniques involved in creating a database-driven Web application with PHP. This section of the book is largely specific to MySQL, the database software used in their examples. By far the most popular database solution for use with PHP, MySQL is free to download and use, and an installation guide is provided in this portion of the book.

The next three chapters cover advanced, but very practical features of PHP: XML parsing, sending email messages, and dynamically generating graphics. Advanced chapters like these at the end of introductory books have a tendency to seem rushed and incomplete, but I was pleased to discover that these formed one of the best-written sections of the book. These lead up to the final chapter, which presents the development of a complete Web-based URL directory manager. This case study gives the reader a rare opportunity to see many of the topics that were covered throughout the book used together in a practical situation, and will be extremely valuable to readers who are approaching the development of their first large-scale Web-based application. If nothing else, this chapter demystifies the inner workings of large Web directories like Yahoo!, providing valuable insight that could otherwise only be gained through real-world experience.

The main weakness of this book, in my opinion, is its lack of value as a reference. This is, I feel, mainly due to the structure of the book (or the lack thereof). Read front-to-back as a tutorial guide to PHP, this book shines; however, in my experience, readers are more likely to read the first third or so of a book and then jump around to learn the specific concepts that interest them, before retiring it to a nearby bookshelf for it to serve as a handy reference. Unfortunately, many of the examples presented throughout the book rely on code fragments from previous chapters and sections. Proper references in such cases (e.g. “see the code on p.148″) are few and far between, making it difficult for the reader who jumps in at an arbitrary point in the text. Some topics are difficult to locate, and often appear in seemingly unrelated sections of the book (the discussion of Regular Expressions, for instance, is buried in the chapter on error handling). This book is simply not structured to serve as a reference, and attempts to use it as such will often result in frustration.

All up, this book provides a capable guide to PHP for developers with little or no programming experience approaching the language for the first time. As an experienced PHP developer, however, I found the structure of the book somewhat lacklustre, and noticed several places where technical detail was sacrificed for the benefit convenient discussion (the section on ‘switch’ statements in Chapter 4, for instance, contains several technical inaccuracies and misleading sample code). If you are looking for an easy to read, hands-on introduction to PHP, “Beginning PHP4″ will serve nicely. As a language reference, however, PHP’s free online manual has a lot more to offer.

“Beginning PHP4″ by Choi, Kent, Lea, Prasad, and Ullman
October 2000 WROX Press (www.wrox.com)
667 pages + 76 pages of Appendices
OVERALL RATING: 3/5
BUY IT: If you’re new to programming and want to learn PHP
FORGET IT: If you need a good PHP reference

Buy it at Amazon.com for $31.99

Free book: Jump Start HTML5 Basics

Grab a free copy of one our latest ebooks! Packed with hints and tips on HTML5's most powerful new features.

No Reader comments

Comments on this post are closed.