Synopses & Reviews
PHP is a simple yet powerful open-source scripting language for creating dynamic web content. The millions of web sites powered by PHP are testament to its popularity and ease of use. PHP is used by both programmers, who appreciate its flexibility and speed, and web designers, who value its accessibility and convenience. Programming PHP is an authoritative guide to PHP 4 and is filled with the unique knowledge of the creator of PHP, Rasmus Lerdorf. This book explains PHP language syntax and programming techniques in a clear and concise manner, with numerous examples that illustrate both correct usage and common idioms. The book also includes style tips and practical programming advice that will help you become not just a PHP programmer, but a good PHP programmer. Programming PHP covers everything you need to know to create effective web applications with PHP. Contents include:
- Detailed information on the basics of the PHP language, including data types, variables, operators, and flow control statements
- Separate chapters on the fundamental topics of functions, strings, arrays, and objects
- Coverage of common PHP web application techniques, such as form processing and validation, session tracking, and cookies
- Material on interacting with relational databases, such as MySQL and Oracle, using the database-independent PEAR DB library
- Chapters on generating dynamic images, creating PDF files, and parsing XML files with PHP
- Advanced topics, like creating secure script, error handling, performance tuning, and writing your own C language extensions to PHP
- A handy quick reference to all the core functions in PHP and all the standard extensions that ship with PHP
Programming PHP is a comprehensive guide to PHP, a simple yet powerful language for creating dynamic web content. The book is co-authored by the creator of PHP, Rasmus Lerdorf, so you'll learn not only how to program in PHP, but how to do it well. This authoritative book explains the language syntax and programming techniques of PHP 4, the latest version of the language, in a clear and concise manner. Programming PHP goes into detail on fundamental topics such as functions, strings, arrays, and objects, with numerous examples that illustrate both correct usage and good PHP style. Programming PHP also presents application development techniques for building modern web sites. You'll learn how to process web forms, handle session data, interact with relational databases such as MySQL, and create dynamic images and PDF files. The book also covers advanced topics like security, manipulating XML data, and writing your own C-language extensions to PHP.
This is a comprehensive guide to PHP, a simple yet powerful language for creating dynamic web content. It is a detailed reference to the language and its applications, including such topics as form processing, sessions, databases, XML, and graphics and Covers PHP 4, the latest version.
About the Author
started the PHP Project back in 1995 and has been actively involved in PHP development ever since. Also involved in a number of other Open Source projects, Rasmus is a longtime Apache contributor and foundation member. He is the author of the first edition of the PHP Pocket Reference, and the co-author of Programming PHP.
Kevin Tatroe has been a Macintosh and Unix programmer for ten years. Being lazy, he's attracted to languages and frameworks that do much of the work for you, such as the AppleScript, Perl, and PHP languages and the WebObjects and Cocoa programming environments. Kevin, his wife Jenn, his son Hadden, and two cats live on the edge of the rural plains of Colorado, just far away enough from the mountains to avoid the worst snowfall, and just close enough to avoid tornadoes. The house is filled with LEGO creations, action figures, and other toys.
Table of Contents
Preface; Audience for This Book; Structure of This Book; Conventions Used in This Book; Comments and Questions; Acknowledgments; Chapter 1: Introduction to PHP; 1.1 What Does PHP Do?; 1.2 A Brief History of PHP; 1.3 Installing PHP; 1.4 A Walk Through PHP; Chapter 2: Language Basics; 2.1 Lexical Structure; 2.2 Data Types; 2.3 Variables; 2.4 Expressions and Operators; 2.5 Flow-Control Statements; 2.6 Including Code; 2.7 Embedding PHP in Web Pages; Chapter 3: Functions; 3.1 Calling a Function; 3.2 Defining a Function; 3.3 Variable Scope; 3.4 Function Parameters; 3.5 Return Values; 3.6 Variable Functions; 3.7 Anonymous Functions; Chapter 4: Strings; 4.1 Quoting String Constants; 4.2 Printing Strings; 4.3 Accessing Individual Characters; 4.4 Cleaning Strings; 4.5 Encoding and Escaping; 4.6 Comparing Strings; 4.7 Manipulating and Searching Strings; 4.8 Regular Expressions; 4.9 POSIX-Style Regular Expressions; 4.10 Perl-Compatible Regular Expressions; Chapter 5: Arrays; 5.1 Indexed Versus Associative Arrays; 5.2 Identifying Elements of an Array; 5.3 Storing Data in Arrays; 5.4 Multidimensional Arrays; 5.5 Extracting Multiple Values; 5.6 Converting Between Arrays and Variables; 5.7 Traversing Arrays; 5.8 Sorting; 5.9 Acting on Entire Arrays; 5.10 Using Arrays; Chapter 6: Objects; 6.1 Terminology; 6.2 Creating an Object; 6.3 Accessing Properties and Methods; 6.4 Declaring a Class; 6.5 Introspection; 6.6 Serialization; Chapter 7: Web Techniques; 7.1 HTTP Basics; 7.2 Variables; 7.3 Server Information; 7.4 Processing Forms; 7.5 Setting Response Headers; 7.6 Maintaining State; 7.7 SSL; Chapter 8: Databases; 8.1 Using PHP to Access a Database; 8.2 Relational Databases and SQL; 8.3 PEAR DB Basics; 8.4 Advanced Database Techniques; 8.5 Sample Application; Chapter 9: Graphics; 9.1 Embedding an Image in a Page; 9.2 The GD Extension; 9.3 Basic Graphics Concepts; 9.4 Creating and Drawing Images; 9.5 Images with Text; 9.6 Dynamically Generated Buttons; 9.7 Scaling Images; 9.8 Color Handling; Chapter 10: PDF; 10.1 PDF Extensions; 10.2 Documents and Pages; 10.3 Text; 10.4 Images and Graphics; 10.5 Navigation; 10.6 Other PDF Features; Chapter 11: XML; 11.1 Lightning Guide to XML; 11.2 Generating XML; 11.3 Parsing XML; 11.4 Transforming XML with XSLT; 11.5 Web Services; Chapter 12: Security; 12.1 Global Variables and Form Data; 12.2 Filenames; 12.3 File Uploads; 12.4 File Permissions; 12.5 Concealing PHP Libraries; 12.6 PHP Code; 12.7 Shell Commands; 12.8 Security Redux; Chapter 13: Application Techniques; 13.1 Code Libraries; 13.2 Templating Systems; 13.3 Handling Output; 13.4 Error Handling; 13.5 Performance Tuning; Chapter 14: Extending PHP; 14.1 Architectural Overview; 14.2 What You'll Need; 14.3 Building Your First Extensions; 14.4 The config.m4 File; 14.5 Memory Management; 14.6 The pval/zval Data Type; 14.7 Parameter Handling; 14.8 Returning Values; 14.9 References; 14.10 Global Variables; 14.11 Creating Variables; 14.12 Extension INI Entries; 14.13 Resources; 14.14 Where to Go from Here; Chapter 15: PHP on Windows; 15.1 Installing and Configuring PHP on Windows; 15.2 Writing Portable Code for Windows and Unix; 15.3 Interfacing with COM; 15.4 Interacting with ODBC Data Sources; Function Reference; PHP Functions by Category; Alphabetical Listing of PHP Functions (a-e); Alphabetical Listing of PHP Functions (f-i); Alphabetical Listing of PHP Functions (j-q); Alphabetical Listing of PHP Functions (r-z); Extension Overview; Optional Extensions Listing; Colophon;