What Does PHP Do?

PHP does anything you want, except sit on its head and spin. Actually, with a little on-the-fly image manipulation and dynamic HTML, it could probably do that, too.

According to the PHP manual, “The goal of the language is to allow Web developers to write dynamically generated pages quickly.”

Here are some common uses of PHP, all of which are a part of what you’ll learn in this book:

• Perform system functions: create, open, read from, write to, and close files on your system; execute system commands; create directories; and modify permissions.

• Gather data from forms: save the data to a file, send data via e-mail, and return manipulated data to the user.

• Access databases and generate content on the fly, or create a Web interface for adding, deleting, and modifying elements within your database.

• Set cookies and access cookie variables.

• Start sessions and use session variables and objects.

• Restrict access to sections of your Web site.

• Create images on the fly.

• Encrypt data.

These are just basic, everyday uses. PHP also includes support for integrating with Java servlets, XML, and myriad other higher-level functions.