ÄúµÄλÖãºÑ°ÃÎÍøÊ×Ò³£¾±à³ÌÀÖÔ°£¾PHP ±à³Ì£¾PHP 5 Power programming
Team LiB
Previous Section Next Section

Chapter Overview

Chapter 1, "What Is New in PHP 5?," discusses the new features in PHP 5. Most of these new features deal with new object-oriented features, including small examples for each feature. It also gives an overview of the new extensions in PHP 5. Most of the topics mentioned in this chapter are explained in more detail in later chapters.

Chapter 2, "PHP 5 Basic Language," introduces the PHP syntax to those readers not familiar with PHP. All basic language constructs and variable types are explained along with simple examples to give the reader the necessary building blocks to build real scripts.

Chapter 3, "PHP 5 OO Language," continues exploring PHP 5's syntax, focusing on its object-oriented functionality. This chapter covers basics, such as properties and methods, and progresses to more complicated subjects, such as polymorphism, interfaces, exceptions, and lots more.

Using the previous chapter as a foundation, Chapter 4, "PHP 5 Advanced OOP and Design Patterns," covers some of the most advanced features of PHP 5's object model. After learning these features, including four commonly used design patterns and PHP's reflection capabilities, you will soon become an OO wizard.

Now that you are familiar with the syntax and language features of PHP, Chapter 5, "How to Write a Web Application with PHP," introduces you to the world of writing web applications. The authors show you basics, such as handling input through form variables and safety techniques, but this chapter also includes more advanced topics, such as handling sessions with cookies and PHP's session extension. You also find a few tips on laying out your source code for your web applications.

Chapter 6, "Databases with PHP 5," introduces using MySQL, SQLite, and Oracle from PHP, but focuses primarily on the PHP 5-specific details of database access. For each database, you learn about some of its strong and weak points, as well as the types of applications at which each excels. And of course, you learn how to interface with them using PHP's native functions or using PEAR DB.

All scripts can throw errors, but of course you do not want them to show up on your web site once your application has passed its development state. Chapter 7, "Error Handling," deals with different types of errors that exist, how to handle those errors with PHP, and how to handle errors with PEAR.

As one of the important new features in PHP 5 is its renewed XML support, a chapter on XML features in PHP 5 could not be missed. Chapter 8, "XML with PHP 5," talks about the different strategies of parsing XML and converting XML to other formats with XSLT. XML-RPC and SOAP are introduced to show you how to implement web services with both techniques.

Although not specifically for PHP 5, the five mainstream extensions that Chapter 9, "Mainstream Extensions," covers are important enough to deserve a place in this book. The first section, "Files and Streams," explains about handling files and network streams. A stream is nothing more than a way to access external data, such as a file, remote URL, or compressed file. The second section, "Regular Expressions," explains the syntax of a regular expression engine (PCRE) that PHP uses with numerous examples to show you how these expressions can make your life easier. In "Date Handling," we explain the different functions used to parse and format date and time strings. In "Graphics Manipulation with GD," we show you through two real-life scenarios the basic functions of creating and manipulating graphics with PHP. The last section in this chapter, "Multibyte Strings and Character Sets," explains the different character sets and the functions to convert and handle different ones, including multi-byte strings used in Asian languages.

Chapter 10, "Using PEAR," introduces PEAR, the PHP Extension and Application Repository. Starting with concepts and installation, the chapter shows how to use PEAR and maintain the local installed packages. This chapter also includes a tour of the PEAR web site.

Chapter 11, "Important PEAR Packages," gives an overview of the most important PEAR packages, along with examples. Packages covered include Template Systems, the Auth package to do authentication, form handling with the HTML_QuickForm package, and a package used to simplify caching.

Chapter 12, "Building PEAR Components," explains how to create your own PEAR package. The PEAR Coding Standard and package.xml package definition format, together with tips on including files and package layout, get you on your way to completing your first PEAR package.

Chapter 13, "Making the Move," deals with the few backward-incompatible changes that were introduced between PHP 4 and PHP 5. This chapter tells you which things you need to take care of when making your application work on PHP 5, and provides workarounds wherever possible.

Chapter 14, "Performance," shows you how to make your scripts perform better. The chapter offers tips on standard PHP usage, the use of external utilities (APD and Xdebug) to find problems in your scripts, and PHP accelerators like APC and Zend Performance Suite.

Chapter 15, "An Introduction to Writing PHP Extensions," explains how to write your own custom PHP extension. We use a simple example to explain the most important things like parameter parsing and resource management.

Chapter 16, "PHP Shell Scripting," shows you how to write shell scripts in PHP, because PHP is useful for more than just web applications. We carefully explain the differences between the CLI and CGI executables in which PHP comes, including command-line parameter parsing and process control.

This book also includes three appendices. Appendix A, "PEAR and PECL Package Index," provides an overview of all important packages, with descriptions and dependencies on other packages. Appendix B, "phpDocument Format Reference," explains the syntax as understood by the PHP Documenter tool to generate API documentation from source code. Appendix C, "Zend Studio Quick Start," is an introduction to working in the Zend Studio IDE.

    Team LiB
    Previous Section Next Section