PHP 5 Recipes: A Problem-Solution Approach was released in 2005. At that time there were still many sites
using the older PHP 4 version of the scripting language, and PHP 5 introduced many new features and a
totally redesigned model for object-oriented programming. Since then PHP has seen many releases, and it’s
time to upgrade the contents and recipes that cover some of the new features that have been added to the
language in the eleven years since the first book. The current version of PHP is 5.6.x and the development
team recently released version 7.0 that promises double the performance and half the memory use
compared to PHP 5.6. The jump from PHP 5 to PHP 7, skipping the major version 6 has to do with a research
project that was labeled PHP 6. This project was abandoned because of complexity and performance
PHP is a scripting language most commonly used to create dynamic web content; in fact about 80
percent of the web servers have PHP installed in some form. PHP can also be used as a general purpose
scripting language for shell scripts, and it’s even possible to create desktop applications with the help of the
PHP-GTK extension. This book is going to focus on web and shell scripting and it is intended for beginners
as well as advanced users.
PHP is a loosely typed scripting language. There is no need to declare variables before using them and
variables can change types as the content changes. As a scripting language there is no need to compile or
otherwise process the code before execution. When the interpreter is instructed to execute a script it will
load the content of the file, perform the compilation, and execute the code if no compilation errors are
found. Various forms of caching can bypass the compilation stage and move directly to execution.