How This Book Is Organized
This book is divided into four parts:
Part I, "Getting Started," is an introduction to PHP.
Part II, "The Language," covers the basic features of the language. Pay particular attention to this section if you are new to programming.
Part III, "Working with PHP," covers PHP in more detail, looking at the functions and techniques you will need to become a proficient PHP programmer.
Part IV, "Extending PHP," examines library code, both code that you can create yourself and PEAR, a repository of library code you can include in your own projects.
Part I contains Hours 1–3 and handles the information you will need to get your first script up and running:
Hour 1, "PHP: From Home Page to Web Enterprise," describes the history and capabilities of PHP and looks at some of the compelling reasons for deciding to learn this scripting language.
Hour 2, "Installing PHP," explains how to install PHP on a Unix system and discusses some of the configuration options you might want to choose when compiling PHP. In this hour, we also examine ways of configuring PHP after it is installed.
Hour 3, "A First Script," covers the different ways in which you can embed a PHP script in a document and create a script that writes text to the user's browser.
Part II comprises Hours 4–9. In this part, you will learn the basic components of the PHP language:
Hour 4, "The Building Blocks," covers the basics of PHP. You will learn about variables, data types, operators, and expressions.
Hour 5, "Going with the Flow," covers the syntax for controlling program flow in your scripts. In addition to if and switch constructs, you will learn about loops using for and while statements.
Hour 6, "Functions," explores the use of functions to organize your code.
Hour 7, "Arrays," discusses the array data type that can be used to hold list information. We will also look at some of the functions PHP provides to manipulate arrays.
Hour 8, "Working with Strings," covers the functions you can use to manipulate strings.
Hour 9, "Objects," introduces PHP's support for classes and objects. Throughout the course of the hour, we will develop a working example.
Part III consists of Hours 10–22. In this part, you will come to grips with the features and techniques of the language:
Hour 10, "Working with Forms," introduces the dimension of user input through the mechanism of the HTML form. You will learn how to gather data submitted via a form.
Hour 11, "Working with Files," shows you how to work with files and directories on the local machine.
Hour 12, "Working with the DBA Functions," demonstrates PHP's support for DBM-style database systems, versions of which are available on most systems.
Hour 13, "Database Integration—SQL," provides a brief introduction to SQL syntax and introduces functions and classes for working with the MySQL database, the SQLite library, and the PEAR::DB package.
Hour 14, "Beyond the Box," covers some of the details of HTTP requests and looks at PHP network functions.
Hour 15, "Images On-the-Fly," explores PHP's image functions. With these, you can create PNG files dynamically.
Hour 16, "Working with Dates and Times," covers the functions and techniques you can use for date arithmetic. We create a calendar example.
Hour 17, "Advanced Objects," examines PHP's new extended support for objects and object-oriented techniques.
Hour 18, "Working with Regular Expressions," introduces regular expression functions. You can use these to find and replace complex patterns in strings.
Hour 19, "Saving State with Cookies and Query Strings," shows you some techniques for passing information across scripts and requests.
Hour 20, "Saving State with Session Functions," extends the techniques explored in Hour 19, using PHP's built-in session functions.
Hour 21, "Working with the Server Environment," shows you how to call external programs from your scripts and incorporate their output into your own.
Hour 22, "XML," looks at PHP's support for the Extensible Markup Language (XML). We examine the XML Parser functions as well as more advanced topics such as DOM and XSLT.
Part IV consists of Hours 23 and Hours 24. In these, we move beyond the core language to examine the ways in which libraries can be used to extend PHP's functionality:
Hour 23, "PEAR: Reusable Components to Extend the Power of PHP," introduces the PHP Extension and Application Repository. You learn how to install packages and work with some examples.
Hour 24, "Towards a Framework for Larger Projects," builds up a code library of your own. We explore some techniques that might be used in deploying a Front Controller enterprise pattern. This example utilizes some of PHP's most advanced object-oriented features.
Finally, we include a glossary that defines some of the more technical terms you might encounter as you work through the book.