Review

Cover of Programming PHP

Programming PHP

Rasmus Lerdorf & Kevin Tatroe
O'Reilly & Associates
$39.95

Review by John Bruzas

 

 

PHP (Personal Home Page Tools) is an open source scripting language primarily designed for creating dynamic web content. A PHP application can interact with a database, process forms, draw graphics, create PDF files, and parse XML. PHP runs on all major operating systems such as UNIX, Linux, Windows and Mac OS and can be used for:

  • Server-side scripting i.e. create dynamic web content
  • Command-line scripting i.e. for system administration tasks such as log parsing
  • Client-side GUI applications i.e. Full-blown, cross-platform GUI applications

This book focuses on Server-side scripting. As such, the book assumes you will most typically be running on a UNIX machine and using PHP as a module for Apache. However, for Windows users, Chapter 15, PHP on Windows, addresses the specifics of PHP use on that platform, including portability.

This book is targeted at the individual who has programmed in the past and understands the basics of writing programs. If you are new to programming and have never programmed before, this book is not yet for you. If you have programmed, particularly using Perl or Java, you will find much that is familiar. You should also have a working knowledge of HTML.

Text and appendices total 469 pages. As you use the book, though, you will find that there is a lot of information presented in a clear and straightforward fashion. What will become evident is just how rich a development platform PHP is. While the book does not come with a CD, both PHP and the code examples are available via the web. PHP can be downloaded from www.php.net as either source-code or binary; Apache web server from www.apache.org; and examples are available on the O’Reilly website at http://examples.oreilly.com/progphp/ as either .tar or .zip files.

When looking at a programming book, I generally look for a number of major characteristics:

  1. Does the book tell me how to get up and running?
  2. Does it provide a solid grounding in the syntax of the language?
  3. Does it have plenty of examples?
  4. Will this book be a useful addition to my reference library?

This book answers all of these questions with a definite YES.

Chapter 1 Introduction to PHP provides a brief history of the language as well as an overview of how the language can be used to create HTML content. Given that one of the co-authors of the book is Rasmus Lensdorf, the creator of PHP, this chapter is particularly insightful.

Chapters 2 through 6 discuss the language itself:

  • Chapter 2, Language Basics, provides a guide to identifiers, data types, operators, flow-control statements, and how to embed PHP code in a web page.
  • Chapter 3, Functions, discusses user-defined functions including scoping, variable-length parameter lists, and variable and anonymous functions.;
  • Chapter 4, Strings, covers functions used to manipulate strings. These include some interesting functions such as approximate equality, soundex, metaphone as well as measures of commonality. regular expressions, both POSIX or PERL-compatible, and functions unique to the web dealing with HTML, URLs and databases.
  • Chapter 5, Arrays, covers functions used to create and manipulate arrays, indexed and associative (i.e. keyed).
  • Chapter 6, Objects, covers PHP's object-oriented features i.e. classes, objects, inheritance and introspection. These functions are particularly valuable for building tools such as debuggers and profilers.

Chapter 7 through 11 covers in some detail the types of things you can create with PHP:

  • Chapter 7, Web Techniques, discusses web basics such as forms (sticky and multivalued), file uploads, form validation, cookies, and sessions.
  • Chapter 8, Databases, discusses how to use PHP to talk to databases. Key here is the non-trivial example that includes a three-table schema.
  • Chapter 9, Graphics, shows how to create and modify image files in a variety of formats from PHP.
  • Chapter 10, PDF, explains how to create PDF files from a PHP application.
  • Chapter 11, XML, introduces PHP's extensions for generating and parsing XML data.

Chapters 12 through 14 provide information on some advanced development concepts.

  • Chapter 12 Security is focused on creating secure scripts.
  • Chapter 13 Application Techniques discuss advanced techniques such as error handling and performance tuning.
  • Chapter 14 Extending PHP discusses how to build PHP extensions using C.

Chapter 15, PHP on Windows, provides easy instructions geared for that platform and discusses the PHP installer which can configure popular Windows servers including Microsoft IIS and Apache. It also discusses using PHP with Windows applications such as Word (completing a document), reading and writing Excel files, and interfacing with ODBC sources.

In addition, there are two appendices which are quite useful:

Appendix A is a Function Reference describing the functions available in the standard PHP extensions. The functions are listed by category; the functions are listed alphabetically. The power afforded by the language is glimpsed in the fact that there are over 400 functions listed with many concentrated in the areas of arrays, strings, and file processing; non-glamorous plumbing areas that can be the programmer’s bane.

Appendix B Extension Overview. This appendix provides an overview of 67 of the optional extensions. These include the libraries for Apache, CCVS (used for credit-card processing), COM, Cybercash, FTP, Java, major databases such as Oracle and Sybase, Verisign Payflow Pro, XML, and ZIP. The production use of the web for ecommerce is indicated by the availability of these extensions.

When I thought of looking at PHP initially, I had the impression that it was a simple scripting language. This book opened my eyes to the broad range of capability afforded by the language.

With respect to audience, this is definitely a book for someone who already has some programming experience. If you are serious about learning PHP, then this book is for you. It's a book you will use and refer to over and over again.

 

All reviews © PC Community and the individual authors.

a
Home  For Members  Join PCC About PCC Contact Us


PC Community, P.O. Box 55513, Hayward, CA 94540-0513
Copyright 2008

Last Updated on May 23, 2004 8:46 PM by Webmaster