PHP 5 Power Programming
Within the last few years, PHP has grown to be the most widespread web platform
in the world, operational in more than a third of the web servers across
the globe. PHP's growth is not only quantitative but also qualitative. More and
more companies, including Fortune companies, rely on PHP to run their business-
critical applications, which creates new jobs and increases the demand
for PHP developers. Version 5, due to be released in the very near future, holds
an even greater promise.
While the complexity of starting off with PHP remains unchanged and
very low, the features offered by PHP today enable developers to reach far
beyond simple HTML applications. The revised object model allows for largescale
projects to be written efficiently, using standard object-oriented methodologies.
New XML support makes PHP the best language available for processing
XML and, coupled with new SOAP support, an ideal platform for
creating and using Web Services.
This book, written by my colleague, Andi Gutmans, and two very prominent
PHP developers, Stig Bakken and Derick Rethans, holds the key to
unlocking the riches of PHP 5. It thoroughly covers all of the features of the
new version, and is a must-have for all PHP developers who are interested in
exploring PHP 5's advanced features
IN THE BEGINNING
It was eight years ago, when Rasmus Lerdorf first started developing PHP/FI.
He could not have imagined that his creation would eventually lead to the
development of PHP as we know it today, which is being used by millions of
people. The first version of “PHP/FI,” called
Personal Homepage Tools/
Form Interpreter,
was a collection of Perl scripts in 1995.
One of the basic
features was a Perl-like language for handling form submissions, but it lacked
many common useful language features, such as
forloops
He could not have imagined that his creation would eventually lead to the
development of PHP as we know it today, which is being used by millions of
people. The first version of “PHP/FI,” called
Personal Homepage Tools/
Form Interpreter,
was a collection of Perl scripts in 1995.
One of the basic
features was a Perl-like language for handling form submissions, but it lacked
many common useful language features, such as
forloops
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.
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.
to download this course click here
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.
to download this course click here
No comments:
Post a Comment