PHP Programming Solutions is intended for both novice and intermediate developers. To this end, chapters are structured such that they start out by solving fairly easy problems, then proceed to more difficult/complex ones. This is deliberately done to give inexperienced PHP developers the fundamental knowledge needed to understand the more complex code listings further along in the chapter.

If you're an experienced PHP developer - say, if you've been using PHP for two years or more - it's quite likely that you'll find this book much less useful than the reader segments described above. Nevertheless, you will certainly find some listings that will intrigue you. Take a look at the table of contents for more.


In order to use the listings in this book, you will need a functioning PHP 5.x installation, ideally with an Apache 2.x Web server and a MySQL 5.x database server. Many of the listings in this book make use of external (free!) classes and extensions; you will almost certainly need to download these classes, or re-compile your PHP build to activate the necessary extensions.

This book also assumes some prior knowledge of PHP, as well as familiarity with HTML, CSS, SQL, XML and client-side scripting. If you're completely new to PHP, this is probably not the first book you should read - instead, consider working your way through the introductory PHP tutorials at and, or purchasing a beginner guide such as How to do Everything with PHP and MySQL (ISBN: 0072257954), and then return to this title.


One of the nice things about a community-supported language like PHP is the access it offers to the creativity and imagination of hundreds of developers across the world. Within the PHP community, the fruits of this creativity may be found in PEAR, the PHP Extension and Application Repository, and PECL, the PHP Extension Community Library, which contains hundreds of ready-made widgets and extensions that developers can use to painlessly add new functionality to PHP.

Using these widgets is often a more efficient alternative to rolling your own code...which is why every chapter in PHP Programming Solutions includes between 4 and 10 recipes which use PEAR/PECL widgets to solve the defined problem, be it creating an HTML progress bar to track uploads or recursively scanning a directory tree for files matching a particular regular expression. Many of these problems can be solved "by hand", but often that's an inefficient approach when a ready-made PEAR class already exists; this book attempts to make such classes more accessible/visible to developers and educate them about some of the hidden jewels in the PEAR and PECL repositories.