This book assumes a certain familiarity with the Internet, the Web, and HTML programming, but it starts with the most basic ideas of programming. It will introduce you to concepts common to all programming languages and how they work in PHP.
Part I. Programming with PHP
Chapter 1. An Introduction to PHP
1.1. The Origins of PHP
1.2. PHP Is Better Than Its Alternatives
1.3. Interfaces to External Systems
1.4. How PHP Works with the Web Server
1.5. Hardware and Software Requirements
1.6. What a PHP Script Looks Like
1.7. Saving Data for Later
1.8. Receiving User Input
1.9. Choosing Between Alternatives
1.10. Repeating Code
Chapter 2. Variables, Operators, and Expressions
2.1. A Top-Down View
2.2. Data Types
2.3. Variables
2.4. Constants
2.5. Operators
2.6. Building Expressions
Chapter 3. Control Statements
3.1. The if Statement
3.2. The ? Operator
3.3. The switch Statement
3.4. Loops
3.5. exit, die, and return
3.6. Exceptions
3.7. Declare
Chapter 4. Functions
4.1. Declaring a Function
4.2. The return Statement
4.3. Scope
4.4. Static Variables
4.5. Arguments
4.6. Recursion
4.7. Dynamic Function Calls
Chapter 5. Arrays
5.1. Single-Dimensional Arrays
5.2. Indexing Arrays
5.3. Initializing Arrays
5.4. Multidimensional Arrays
5.5. Casting Arrays
5.6. The + Operator
5.7. Referencing Arrays Inside Strings
Chapter 6. Classes and Objects
6.1. Object-Oriented Programming
6.2. The PHP 5 Object Model
6.3. Defining a Class
6.4. Constructors and Destructors
6.5. Cloning
6.6. Accessing Properties and Methods
6.7. Static Class Members
6.8. Access Types
6.9. Binding
6.10. Abstract Methods and Abstract Classes
6.11. User-Level Overloading
6.12. Class Autoloading
6.13. Object Serialization
6.14. Namespaces
6.15. The Evolution of the Zend Engine
Chapter 7. I/O and Disk Access
7.1. HTTP Connections
7.2. Writing to the Browser
7.3. Output Buffering
7.4. Environment Variables
7.5. Getting Input from Forms
7.6. Passing Arrays in Forms
7.7. Cookies
7.8. File Uploads
7.9. Reading and Writing to Files
7.10. Sessions
7.11. The include and require Functions
7.12. Don't Trust User Input
Part II. Functional Reference
Chapter 8. Browser I/O
8.1. Pregenerated Variables
8.2. Pregenerated Constants
8.3. Sending Text to the Browser
8.4. Output Buffering
8.5. Session Handling
8.6. HTTP Headers
Chapter 9. Operating System
9.1. Files
9.2. Compressed File Functions
9.3. Direct I/O
9.4. Debugging
9.5. POSIX
9.6. Shell Commands
9.7. Process Control
Chapter 10. Network I/O
10.1. General Network I/O
10.2. Sockets
10.3. FTP
10.4. Curl
10.5. SNMP
Chapter 11. Data
11.1. Data Types, Constants, and Variables
11.2. Arrays
11.3. Objects and Classes
11.4. User Defined Functions
Chapter 12. Encoding and Decoding
12.1. Strings
12.2. String Comparison
12.3. Encoding and Decoding
12.4. Compression
12.5. Encryption
12.6. Hashing
12.7. Spell Checking
12.8. Regular Expressions
12.9. Character Set Encoding
Chapter 13. Math
13.1. Common Math
13.2. Random Numbers
13.3. Arbitrary-Precision Numbers
Chapter 14. Time and Date
14.1. Time and Date
14.2. Alternative Calendars
Chapter 15. Configuration
15.1. Configuration Directives
15.2. Configuration
Chapter 16. Images and Graphics
16.1. Analyzing Images
16.2. Creating Images
Chapter 17. Database
17.1. DBM-Style Database Abstraction
17.2. DBX
17.3. LDAP
17.4. MySQL
17.5. ODBC
17.6. Oracle
17.7. Postgres
17.8. Sybase and Microsoft SQL Server
Chapter 18. Object Layers
18.1. COM
18.2. CORBA
18.3. Java
Chapter 19. Miscellaneous
19.1. Apache
19.2. IMAP
19.3. MnoGoSearch
19.4. OpenSSL
19.5. System V Messages
19.6. System V Semaphores
19.7. System V Shared Memory
Chapter 20. XML
20.1. DOM XML
20.2. Expat XML
20.3. WDDX
Part III. Algorithms
Chapter 21. Sorting, Searching, and Random Numbers
21.1. Sorting
21.2. Built-In Sorting Functions
21.3. Sorting with a Comparison Function
21.4. Searching
21.5. Indexing
21.6. Random Numbers
21.7. Random Identifiers
21.8. Choosing Banner Ads
Chapter 22. Parsing and String Evaluation
22.1. Tokenizing
22.2. Regular Expressions
22.3. Defining Regular Expressions
22.4. Using Regular Expressions in PHP Scripts
Chapter 23. Database Integration
23.1. Building HTML Tables from SQL Queries
23.2. Tracking Visitors with Session Identifiers
23.3. Storing Content in a Database
23.4. Database Abstraction Layers
Chapter 24. Networks
24.1. HTTP Authentication
24.2. Controlling the Browser's Cache
24.3. Setting Document Type
24.4. Email with Attachments
24.5. HTML Email
24.6. Verifying an Email Address
Chapter 25. Generating Graphics
25.1. Dynamic Buttons
25.2. Generating Graphs on the Fly
25.3. Bar Graphs
25.4. Pie Charts
25.5. Stretching Single-Pixel Images
Part IV. Software Engineering
Chapter 26. Integration with HTML
26.1. Sprinkling PHP within an HTML Document
26.2. Using PHP to Output All HTML
26.3. Separating HTML from PHP
26.4. Generating HTML with PHP
Chapter 27. Design
27.1. Writing Requirements Specifications
27.2. Writing Design Documents
27.3. Change Management
27.4. Modularization Using include
27.5. FreeEnergy
27.6. Templates
27.7. Application Frameworks
27.8. PEAR
27.9. URLs Friendly to Search Engines
Chapter 28. Efficiency and Debugging
28.1. Optimization
28.2. Measuring Performance
28.3. Optimize the Slowest Parts
28.4. When to Store Content in a Database
28.5. Debugging Strategies
28.6. Simulating HTTP Connections
28.7. Output Buffering
28.8. Output Compression
28.9. Avoiding eval
28.10. Don't Load Extensions Dynamically
28.11. Improving Performance of MySQL Queries
28.12. Optimizing Disk-Based Sessions
28.13. Don't Pass by Reference (or, Don't Trust Your Instincts)
28.14. Avoid Concatenation of Large Strings
28.15. Avoid Serving Large Files with PHP-Enabled Apache
28.16. Understanding Persistent Database Connections
28.17. Avoid Using exec, Backticks, and system If Possible
28.18. Use php.ini-recommended
28.19. Don't Use Regular Expressions Unless You Must
28.20. Optimizing Loops
28.21. IIS Configuration
Chapter 29. Design Patterns
29.1. Patterns Defined
29.2. Singleton
29.3. Factory
29.4. Observer
29.5. Strategy
Appendix A. Escape Sequences
Appendix B. ASCII Codes
Appendix C. Operators
Appendix D. PHP Tags
Appendix E. PHP Compile-Time Configuration
Appendix F. Internet Resources
F.1. Portals
F.2. Software
Appendix G. PHP Style Guide
G.1. Comments
G.2. Function Declarations
G.3. Compound Statements
G.4. Naming
G.5. Expressions
This book is organized into four main sections: an introduction to programming; a reference for all the functions in PHP; a survey of common programming problems; and finally a guide for applying this knowledge to Web site development. The first section deals with the issues involved with any programming language: what a PHP script looks like; how to control execution; how to deal with data. The second section organizes the functions by what they do and gives examples of their use. PHP offers many functions, so this section is larger than the rest. The third section deals with solving common programming problems such as sorting and generating graphics. The last section offers advice about how to create a whole Web site with PHP.