Table of Contents

This book is organized as a tutorial, so it's best to read the chapters in order. This ensures that you learn basic techniques in a structured manner.

Here's a quick preview of what each chapter in PHP: A Beginner's Guide contains:

Chapter 1: Introducing PHP introduces the PHP programming language, explains why it's so popular for Web application development, and explains how the components of a typical PHP system interact.

Chapter 2: Using Variables and Operators explains PHP's data types, variables and operators, and discusses one of PHP's most popular applications, form input processing.

Chapter 3: Controlling Program Flow demonstrates how to add intelligence to PHP scripts with conditional statements, automate repetitive tasks with loops, and make use of built-in functions for working with strings and numbers.

Chapter 4: Working with Arrays introduces PHP's array data type, explains how it can be used with loops and Web forms, and demonstrates some of PHP's built-in functions to sort, merge, add, modify and split arrays.

Chapter 5: Using Functions and Classes provides a crash course in two of PHP's more complex features, functions and classes. Recursion, variable-length argument lists, visibility, extensibility and reflection are just some of the topics covered in this chapter, which focuses on PHP's frameworks for turning frequently-used code blocks into reusable components.

Chapter 6: Working with Files and Directories explains PHP's filesystem functions, demonstrating the PHP routines available to read and write files, create and modify directories, and work with file paths and attributes.

Chapter 7: Working with Databases and SQL explains databases and Structured Query Language (SQL), and then introduces the two databases most commonly-used with PHP: MySQL and SQLite. It illustrates how PHP can be used to build Web applications that interact with a database to view, add and edit data, and also discusses new database portability features.

Chapter 8: Working with XML explains basic XML concepts and technologies, and discusses how PHP can be used to process XML data using the SimpleXML extension.

Chapter 9: Working with Cookies, Sessions and Headers explains PHP's built-in functions to create sessions and cookies, and demonstrates how these functions can be used to make Web applications more user-friendly.

Chapter 10: Handling Errors focuses on PHP's error-handling framework. It explains the PHP 6 error and exception model, and shows how to create customized error handling routines tailored to specific requirements.

Chapter 11: Securing PHP discusses security issues and common attacks, and suggests ways to increase the security of a PHP application. It discusses key application-hardening techniques of input validation, output escaping, and PHP security configuration.

Chapter 12: Extending PHP introduces you to two of the largest repositories of free PHP code on the Internet: PEAR, the PHP Extension and Application Repository, and PECL, the PHP Extension Community Library. It explains how freely-available components from these repositories can be used to quickly add new capabilities and features to PHP, making application development faster and more effective.

Appendix A: Installing and Configuring Required Software discusses the process of obtaining, installing and configuring Apache, PHP, MySQL and SQLite.

Appendix B: Answers to Self Test provides answers to the self-test questions that appear at the end of each chapter in this book.

Special Features

Try This Each chapter contains at least one self-contained, hands-on project that is relevant to the topic under discussed and that the reader can use to gain a practical understanding of the material.

Ask the Expert Each chapter contains one or two Ask the Expert sections that provide expert guidance and information on questions that might arise about the material presented in the chapter.

Self Test Each chapter ends with a Self Test, which is a set of questions that tests you on the information and skills you learned in that chapter. The answers to the Self Test are included at the end of the book.