Part II: FUNCTIONAL REFERENCE
The chapters in this section of the book, Chapters 8 through 14 , are a functional
reference. They describe how each PHP function works: what arguments are expected,
what value is returned, and how they ought to be used. The functions are grouped
generally by what they do.
Chapter 8 is concerned with I/O—input and output. Input functions send and receive
information to the browser, and output functions read and write to the file system or to
the network. Chapter 9 is all about manipulating data. There are functions for handling
arrays, functions for searching for information inside strings, and functions for encoding
and decoding information. Chapter 10 is concerned with mathematics. Aside from the
standard mathematical functions you expect, PHP offers some unique features for
handling arbitrarily large or small numbers. Chapter 11 is a bit of a catch-all chapter that
deals with time-related functions and functions that affect the configuration of PHP.
There are functions for normal dates and times, but there are also functions for working
with obscure calendars. In addition, there are plenty of functions for changing the
operation of PHP itself. Chapter 12 is a short but important chapter on graphics
functions. The GD library allows you to create and manipulate images on the fly.
Chapter 13 is a long chapter about all the different database functions. If PHP can boast
of one great achievement, it is certainly support for many databases. In this chapter, you
will find native support for popular commercial databases such as Oracle and Sybase, as
well as support for free technologies like MySQL. Chapter 14 contains miscellaneous
functions, most of which interface with specialized libraries, such as functions for
communicating with LDAP and IMAP servers.
Throughout this section I've used a standard format for showing how a function works.
The form I've chosen is compact yet clear. Each description begins with a prototype for
the function. This tells you what type of data the function returns and what type of data is
expected to be passed. When a function returns nothing, it will not be preceded with a
datatype. Likewise, if a function takes no arguments, the parentheses following the
function's name will be empty.
Some functions are part of PHP's basic functions and are always available. Others are
part of an extension which must be loaded through special files, or added when you
compile PHP. Without doing either of these things, you will get an error reporting an
unrecognized function. There are more extensions than I cover here. Some may have
been written after this text went to press. Others are very specialized.
A lot of effort went into checking for bugs in the functional reference, but it's possible
some will slip through. As I did with the first edition, I will make an errata page available
on my Web site http://www. leonatkinson. com. If an example doesn't work as you
expect, check there first.