Foreword

I have been programming computers for a long time. In that time, I have moved between more languages than I can count. With each new language, I have always said that once you learn how to program properly, everything else is just syntax. I still believe that's true for a lot of languages, but for PHP, that may be an oversimplification.

In PHP, there are usually several ways to accomplish any given task. Some of them are better than others, but a few of them—mainly, anything that requires the globals command—are outright wrong. This is always confusing to programmers new to PHP because if there are several correct ways to accomplish a task, how do you know which one is the best?

"Best Practices" has been a theme in the PHP community for several years now as an attempt to answer this question. Whenever a new member of the PHP community asks me where to learn the Best Practices of programming PHP, I invariably point them to Vikram's "PHP 101" series, posted in several places around the Web. His work on that 14-part series has earned him a name in the community as an authority not only on teaching new users how to program but teaching them how to program correctly.

I have had the pleasure of working with Vikram for two years now on DevZone. His articles are without a doubt some of the most popular we have published. I know as you read this book you will come to understand why.

-- Cal Evans, Editor-in-chief, Zend’s DevZone