I. LANGUAGE CONSTRUCTS AND TECHNIQUES.
1. Working with Strings.
Introduction. Finding Parts of Strings. The Ternary Operator. Variable Exchange. Working with ASCII Characters and Values. Processing a String One Character at a Time. Reversing Words or Characters. Creating a Unique Identifier. Encryption and Decryption. Converting Case. Escaping Characters. Trimming Blanks from the Strings. Parsing Comma-Separated Data. Converting Cyrillic Character Sets. Parsing a URL. Finding the Soundex Key of a String.
Introduction. Checking Whether a Variable Is a Valid Number. Working with Numbers That Are Not Double or Long. Rounding Arbitrary-Precision Numbers. Converting Between Binary and Decimal. Working on a Series of Numbers. Working with Roman Numerals. Generating Random Numbers. Making Numbers Even More Random. Generating Different Random Numbers. Generating Biased Random Numbers. Working with Trigonometry in Degrees Not Radians. Calculating More Trig Functions. Fun with Logarithms. Validating Credit Card Numbers. Converting Between Octal and Hexadecimal. Placing Commas in Numbers. Converting Numbers Between Different Bases.
3. Dates and Times.
Introduction. Loading Today's Date into an Array. Checking the Validity of a Date. Determining Date Intervals. Finding the Date and Time for Different Locales. Formatting Timestamps. Parsing Dates and Times from Strings. Performing Benchmarks. Halting Program Execution.
Introduction. Specifying an Array in Your Program. Printing a List with Commas. Changing the Size of an Array. Doing Something to Every Item of an Array. Iterating over an Array by Reference. Extracting Unique Elements from a List. Returning the Current Element from an Array. Finding Elements in One Array but Not Another. Computing Union, Intersection, or Difference of Unique Arrays. Appending One Array to Another. Reversing an Array. Processing Multiple Elements of an Array. Finding the First Element in an Array That Passes a Test. Finding All Elements That Match a Certain Criteria. Sorting an Array by a User-Defined Comparison. Randomizing an Array. Perl-Based Array Manipulation Features. Sensible Sorting.
5. Associative Arrays.
Introduction. Adding an Element to an Associative Array. Testing for the Presence of a Key in an Associative Array. Deleting an Entry from an Associative Array. Moving Through an Associative Array. Printing an Associative Array. Dealing with Arrays in More Than One Dimension. Checking for the Existence of a Value. Inverting an Associative Array. Sorting an Associative Array and Maintaining Index Association. Merging Associative Arrays.
6. Regular Expressions.
Introduction. Copying and Substituting at the Same Time. Matching Letters. Using Perl-Compatible Regular Expressions in PHP. -Incompatibilities Between the PCRE Library and Perl Regular Expressions. Matching over Multiple Lines. Reading Records Separated by a String. Extracting a Range of Lines. Validating Web Data with Regular Expressions. Testing for a Valid Regular Expression. Finding the Nth Occurrence of a Match. Detecting Duplicate Words. Validating an Email Address. Matching Abbreviations.
7. File Access.
Introduction. Opening a File. Creating Temporary Files. Storing a File into Your Program. Testing Whether a File Exists. Flushing the Cache. Locking Files. Getting the Free Space Available on a Specified Drive. Displaying a Textfile to the User. Checking File Permissions. STDIN, STDOUT, STDERR.
8. File Contents.
Introduction. Reading Lines with Continuation Characters. Tabulating Lines (or Paragraphs or Records) in a File. Processing Every Word in a File. Reading a File Backward by Line. Picking a Random Line from a File. Randomizing All the Lines in a File. Reading a Particular Line in a File. Processing Variable-Length Text Fields. Removing the Last Line from a File. Processing Binary Files. Updating a Random-Access File. Reading Fixed-Length Records. Reading and Creating Configuration Files.
Introduction. Getting and Changing Timestamps. Deleting a File. Copying or Moving a File. Recognizing Two Names for the Same File. Loading All Files in a Directory into an Array. Getting a List of Filenames Matching a Pattern. Processing All Files in a Directory. Removing a Directory and Its Contents. Splitting a File into Its Component Parts. Program 20,000 Leagues into Your Site.
1Introduction. Passing a Default Value to a Function. Accessing Variables Outside a Function. Returning Values from a Function. Passing Arguments by Reference. Retaining a Variable's Value Between Function Calls. Returning More Than One Value from a Function. Declaring Functions Dynamically. Dynamically Creating Anonymous Functions. Calling Functions Indirectly. Fetching an Arbitrary Number of Parameters.
Introduction. Creating a Class. Accessing Variables from Within a Class. Inheritance. Making Variables or Functions Public and Private. Creating a Constructor. Returning a Different Object from a Constructor. Creating a Class Destructor. Using Functions in a Class Without Initializing an Object. Indirectly Accessing a Method of the Parent Class. Returning an Error Object on Failure.
12. Maintaining Sessions with PHP.
Introduction. Creating a Session Variable with PHP. Saving Sessions Using a Database. Setting the Session Name. Setting and Getting Cookie Parameters. Unregistering a Variable in a Session. Deleting All the Session Variables. Using Objects as Session Variables. Encode That Data. Creating a Shopping Cart Using Sessions and PHP. Serialization. WDDX Serialization. WDDX Deserialization.
13. Web Automation.
Parsing a Web Server Log File.
14. Working with PHP's Built-in Arrays and Constants.
Working with File Constants. PHP's OS and Version Constants. Setting Breakpoints by Using PHP's Error Constants. Defining Your Own PHP Constants. Working with PHP Globals. Accessing Data Through PHP's Built-in Arrays.
Introduction. Creating and Opening a DBM Database. Inserting Values into a DBM Database. Replacing Values in a DBM Database. Deleting Values from a DBM Database. Looping Through a DBM Database.
16. Creating a Database-Independent API with PHP.
Introduction. The Glue. The MySQL Module. The mSQL Module. The Oracle Module. The MSSQL Module. The ODBC Module. The PostgreSQL Module. The InterBase Module. The Sybase Module.
III. GOING OUTSIDE PHP.
17. Interfacing with Other Programs and Languages.
Introduction. Capturing the Output of Another Program. Printing the Output of a Program. Opening a Pipe to Another Program. Working with Sockets. Working with COM Objects. Accessing Predefined Java Methods and Classes. Accessing Your Own Custom Java Methods and Classes.
Introduction. Opening an IMAP Mailbox. Checking Whether an IMAP Stream Is Still Active. Converting Messages to a Readable Format. Sending Email. Sending Attachments with PHP. Sending Binary Attachments. Sending HTML Email. Getting the Size of a Message. Parsing Mail Headers.
19. LDAP and SNMP.
Introduction. Adding an Entry to an LDAP Server. Deleting an Entry from an LDAP Server. Executing a Query and Getting the Results in an Array. Freeing an LDAP Result Set. Performing a Tree Search on an LDAP Server. Sorting the Results of an LDAP Search. Fetching All SNMP Objects into an Array. Setting an SNMP Object. Getting an SNMP Object.
Introduction. Performing an SSL Transaction. HTTP File Uploading. Excluding/Including the Header from a CURL Transfer. Debugging CURL Transfers. Performing an HTTP POST Operation. Connecting Through a Proxy Server. Sending Cookies. A TCP Client. A TCP Server. Reading and Writing to Sockets. A UDP Client. A UDP Server. UNIX Domain Sockets. Handling Multiple IP Addresses. Nonblocking Sockets. Reading and Writing Vectors. Controlling Data Transfer Timeout. Getting Socket Status.
IV. GENERATING OTHER LANGUAGES.
21. Image Creation and Management.
Creating an Image with GD. Opening a Preexisting Image. Getting the Size of an Image. Adding Text to Images. Getting the Color of a Certain Part of an Image. Getting the Total Number of Colors in an Image. Making a GIF/PNG Transparent. Copy One Part of an Image to Another. Drawing Rectangles. Drawing Polygons. Drawing an Arc. Making an Image Interlaced. Dynamic Buttons. Using TrueType Fonts.
Introduction. Error Handling. Parsing a Simple XML Document. Parsing an XML Document into an Array. Mapping XML Tags. Setting Up