Trusted SF Member
Joined: 26 Aug 2003
Location: Warwickshire, England, UK
|Posted: Sun Nov 27, 2005 3:27 pm Post subject: Book Review - Learning PHP 5
Learning PHP 5
Author(s): David Sklar
Publisher: O'Reilly http://www.oreilly.com
Date Published: July 2004
Book Specifications: Softcover, 348 pages
Category: Web Programming
Publisher's Suggested User Level: Not Rated
Reviewer's Recommended User Level: Beginner - Intermediate
Suggested Publisher Price: $29.95 US / $43.95 CDN
Blurb from back cover:
PHP has gained a following among nontechnical web designers who need to add interactive aspects to their sites. Offering a gentle learning curve, PHP is an accessible yet powerful language for creating dynamic web pages. As its popularity has grown, PHP's basic feature set has become increasingly more sophisticated. Now PHP 5 boasts advanced features – such as new object-oriented capabilities and support for XML and Web services – that will please even the most experienced web professionals, while still remaining user-friendly enough for those with a lower tolerance for technical jargon.
If you want to try your hand at PHP 5 but don't know where to start, then Learning PHP 5 is the book you need. With attention to both PHP 4 and the new PHP Version 5, it provides everything from an explanation of how PHP works with your web server and web browser to the ins and outs of working with MySQL databases and HTML forms. Written by the coauthor of the popilar PHP Cookbook, this book is for intelligent (but not necessarily highly technical) readers.
As a language for flexible, dynamic web solutions, PHP is rapidly becoming the most used, and most useful programming language for the web. This book, along with some hard work and practice, should have you on your way to becoming a competent PHP programmer.
Chapter Synopsis & Review Comments
Chapter 1 begins with a broad sweep over PHP's place online, the concepts behind PHP, and the basic rules of PHP programs. Information is presented in an easy to follow format, and concepts are introduced in an order which allows rapid progression whilst maximising understanding.
Chapter 2 looks at text and numbers, covering the PHP concept of strings, including the three types of string literal PHP can handle. The chapter then leads into manipulating and formatting text, before moving on to discuss numbers. Variables are introduced after the discussion of string and numeric literals, and operations on variables are also covered. The chapter ends with a few simple exercises, designed to reinforce the topics covered so far.
Chapter 3 introduces the program logic – decision making and repetition – within PHP. Complicated if() ... else() loops are covered, and looping is explained. Exercises again end the chapter.
Arrays are the topic of chapter 4. Arrays can be a difficult concept to grasp, especially if the reader has no prior programming experience, and this chapter excels in explaining the concept of an array in easy to understand terms, with examples and illustrations.
Chapter 5 looks at functions, declaring functions, passing arguments and returning values.
Chapter 6 describes web forms. The PHP involved in form processing is described here, with numerous examples. Server variables are covered, and this is the first point in the book where it becomes obvious how powerful PHP is for web programming. Data validation is also covered, and the chapter ends with five exercises.
Databases are covered in chapter 7, with discussions of organising data within the database, connecting to a database, creating a table, inserting data and retrieving data. Throughout the chapter, 'SQL Lessons' provide the background into the SQL language used for database interaction. The chapter also looks at MySQL specific database access, as opposed to the PEAR database libraries. Equal coverage of PostgreSQL would have been useful here, since PostgreSQL is becoming increasingly used in place of MySQL.
Chapter 8 deals with cookies and sessions, aspects of PHP designed to overcome the lack of persistence in the HTTP protocol driving web site transmissions across the Internet.
Chapter 9 covers date and time manipulations, and chapter 10 looks at file manipulation.
Chapter 11 is concerned with XML, for which PHP provides powerful processing capabilities. Parsing XML and generating XML are both covered. Given the increased use of RSS feeds to syndicate sites, this capability of PHP will be in increasing demand.
Debugging is the topic of chapter 12. Error fixing is covered in detail, and inspecting program data is touched upon.
Chapter 13 opens the door to the outside world, looking at the additional possibilities with PHP, such as generating graphics, PDF files and mail processing. File uploads are also covered here, though this would be better discussed in chapter 6 along with the rest of the form processing content.
The book ends with appendices on installing PHP, regular expressions (discussion of which really should have been part of the main text of the book, considering the power of regular expressions in PHP, and how frequently they are used), and exercise answers.
Style and Detail
The discussion is paced for beginners, and those who already program a different language may become bored with the book as it does not give enough information quickly enough for them. However, the book is aimed at beginners, and the pace is correct for this purpose.
Some topics are presented in an order which makes little sense. Examples include the positioning of discussion of regular expressions in an appendix, when they would be more suited to a chapter of their own, shortly after string manipulations, and the form upload processing, which should have been in chapter 6 with the rest of the form code, not chapter 13, where people are less likely to find it.
There is little that can be faulted with this book in so far as its target audience. However, the O'Reilly “Learning ...” series usually provides an introduction to a language from which the reader can then go on to pick up additional information from online sources or other books. I do not think this book quite reaches that stage.
The information in the book is clearly targetted at the beginner, and those who wish to use PHP purely to add some dynamic content to a website, rather than those looking to learn PHP to work on larger, more complex web systems. At the very least, this book could have included some more advanced topics, including more comprehensive coverage of graphics manipulation using PHP.
Furthermore, the regular expressions discussion, which was stuck in an appendix, was minimal. Since regular expressions play an important role in PHP, and form validation is made considerably easier with their use, this topic at the very least should have received more emphasis in this book.
The book makes a reasonable read for the beginner, but still lacks that which sets the O'Reilly “Learning ...” series aside from other introductory books on programming languages.
This book receives an honoured SFDC Rating of 7/10.
Keywords: PHP, web programming
This review is copyright 2005 by the author, Andrew J. Bennieston, and Security-Forums Dot Com, and may not be reproduced in any form in any media without the express permission of the author, or Security-Forums Dot Com.