Preface
My first inkling that I might like to write a book about PHP was born out of the
frustration I felt with the original PHP manual. It was a single, large HTML file with all
the functions in alphabetical order. It was also on a Web server thousands of miles away
from me in Canada, so it was slow to show up in my browser, even across a T
connection. It wasn't long before it was saved on my desktop. After struggling for several
months, it started to dawn on me that I could probably organize the information into a
more usable format. Around that time the next version of PHP began to take shape, and
with it a new manual was developed. It was organized around PHP's source code but was
less complete than the old PHP manual. I contributed descriptions for some of the
missing functions, but I still had the idea to write my own manual. In the spring of 1998
Prentice Hall gave me the opportunity to do so. It is an honor for my book to be among
Prentice Hall classics such as The C Programming Language by Brian Kernighan and
Dennis Ritchie.
This book assumes a certain familiarity with the Internet, the Web, and HTML
programming, but it starts with the most basic ideas of programming. It will introduce
you to concepts common to all programming languages and how they work in PHP. You
can expect this book to teach you how to create rich, dynamic Web sites. You can also
expect it to remain on your desk as a reference for how PHP works, or even as a recipe
book for solving common design problems.
This book is not for dummies, nor is it for complete idiots. That you are considering PHP
is a great indication of your intelligence, and I'd hate to insult it. Some of the ideas in this
book are hard to understand. If you don't quite get them the first time, I encourage you to
reread and experiment with the examples.
If you are uncomfortable writing HTML files, you may wish to develop this skill first.
Marty Hall's Core Web Programming provides an excellent introduction. Beyond HTML,
numerous other topics I touch on fall out of scope. Whenever I can, I suggest books and
Web sites that provide more information. There are even some aspects of PHP that range
too far from the focus on writing PHP scripts. An example is writing extensions for PHP
in C. This involves a healthy knowledge of C programming that I cannot provide here.
Related to this is compiling and installing PHP. I attempt to describe the process of
installing PHP, which can involve compiling the source code, but I can't attempt to
pursue all the different combinations of operating system, Web server, and extensions. If
you are comfortable running make files, you will find the information that comes with the
PHP source code more than adequate.
Along with the explanation text I've provided real-world examples. Nothing is more
frustrating than trying to adapt some contrived academic problem to the Web site you
must have working by the end of the week. Some of the examples are based on code from
live Web sites I have worked on since discovering PHP in 1997. Others are distilled from
the continual discussion being conducted on the PHP mailing lists.