Synopses & Reviews
Now installed on more than 20 million Internet domains around the world, PHP is an undisputed leader in web programming languages. Database connectivity, powerful extensions, and rich object-orientation are all reasons for its popularity, but nearly everyone would agree that, above all, PHP is one of the easiest languages to learn and use for developing dynamic web applications. The ease of development and simplicity of PHP, combined with a large community and expansive repository of open source PHP libraries, make it a favorite of web designers and developers worldwide.
PHP in a Nutshell is a complete reference to the core of the language as well as the most popular PHP extensions. This book doesn't try to compete with or replace the widely available online documentation. Instead, it is designed to provide depth and breadth that can't be found elsewhere. PHP in a Nutshell provides the maximum information density on PHP, without all the fluff and extras that get in the way. The topic grouping, tips, and examples in this book complement the online guide and make this an essential reference for every PHP programmer. This book focuses on the functions commonly used by a majority of developers, so you can look up the information you need quickly. Topics include:
- Object-oriented PHP
- String manipulation
- Working with files
- Database interaction
- Multimedia creation
Whether you're just getting started or have years of experience in PHP development, PHP in a Nutshell is a valuable addition to your desk library.
"PHP in a Nutshell" is a complete reference to the core of the language as well as the most popular PHP extensions. This book doesn't try to compete with or replace the widely available online documentation. Instead, it is designed to provide depth and breadth that can't be found elsewhere.
About the Author
Andrew Hudson is a regular freelance contributor to "Linux Format "magazine, the UK's largest Linux magazine. His particular area of expertise is Fedora and the Red Hat Enterprise Linux platform. Paul Hudson is Editor of "Linux Format "magazine, a professional developer, and full-time journalist for Future Publishing. His articles have appeared in "Mac Format," "PC Answers," "PC Format," "PC Plus," and "Linux Format,"
Table of Contents
About the Author; Preface; Audience; Assumptions; Contents of This Book; Conventions Used in This Book; Using Code Examples; Safari® Enabled; How to Contact Us; Acknowledgments; Chapter 1: Introduction to PHP; 1.1 PHP History; 1.2 Advantages of PHP; 1.3 Getting Help; 1.4 Getting Certified; 1.5 PHP Resources; Chapter 2: Installing PHP; 2.1 Installing on Windows; 2.2 Installing on Unix; 2.3 Testing Your Configuration; 2.4 System Configuration; Chapter 3: The PHP Interpreter; 3.1 Running PHP Scripts; 3.2 Extending PHP; 3.3 PEAR; 3.4 Abnormal Script Termination; Chapter 4: The PHP Language; 4.1 The Basics of PHP; 4.2 Variables; 4.3 Whitespace; 4.4 Heredoc; 4.5 Brief Introduction to Variable Types; 4.6 Code Blocks; 4.7 Opening and Closing Code Islands; 4.8 Comments; 4.9 Conditional Statements; 4.10 Case Switching; 4.11 Loops; 4.12 Infinite Loops; 4.13 Special Loop Keywords; 4.14 Loops Within Loops; 4.15 Mixed-Mode Processing; 4.16 Including Other Files; 4.17 Functions; Chapter 5: Variables and Constants; 5.1 Types of Data; 5.2 True or False; 5.3 Strings; 5.4 Integers; 5.5 Floats; 5.6 Automatic Type Conversion; 5.7 Checking Whether a Variable Is Set: isset(); 5.8 Variable Scope; 5.9 Variable Variables; 5.10 Superglobals; 5.11 Using $_ENV and $_SERVER; 5.12 References; 5.13 Constants; 5.14 Arrays; Chapter 6: Operators; 6.1 Arithmetic Operators; 6.2 Assignment Operators; 6.3 String Operators; 6.4 Bitwise Operators; 6.5 Comparison Operators; 6.6 Incrementing and Decrementing Operators; 6.7 Logical Operators; 6.8 Some Operator Examples; 6.9 The Ternary Operator; 6.10 The Execution Operator; 6.11 Operator Precedence and Associativity; Chapter 7: Function Reference; 7.1 Undocumented Functions; 7.2 Handling Non-English Characters; Chapter 8: Object-Oriented PHP; 8.1 Conceptual Overview; 8.2 Classes; 8.3 Objects; 8.4 Properties; 8.5 The 'this' Variable; 8.6 Objects Within Objects; 8.7 Access Control Modifiers; 8.8 Object Type Information; 8.9 Class Type Hints; 8.10 Constructors and Destructors; 8.11 Copying Objects; 8.12 Comparing Objects with == and ===; 8.13 Saving Objects; 8.14 Magic Methods; 8.15 Static Class Methods and Properties; 8.16 Helpful Utility Functions; 8.17 Interfaces; 8.18 Dereferencing Object Return Values; Chapter 9: HTML Forms; 9.1 What Does It Mean to Be Dynamic?; 9.2 Designing a Form; 9.3 Handling Data; 9.4 Splitting Forms Across Pages; 9.5 Validating Input; 9.6 Form Design; 9.7 Summary; Chapter 10: Cookies and Sessions; 10.1 Cookies Versus Sessions; 10.2 Using Cookies; 10.3 Using Sessions; 10.4 Storing Complex Data Types; Chapter 11: Output Buffering; 11.1 Why Use Output Buffering?; 11.2 Getting Started; 11.3 Reusing Buffers; 11.4 Stacking Buffers; 11.5 Flushing Stacked Buffers; 11.6 Reading Buffers; 11.7 Other OB Functions; 11.8 Flushing Output; 11.9 Compressing Output; 11.10 URL Rewriting; Chapter 12: Security; 12.1 Security Tips; 12.2 Encryption; Chapter 13: Files; 13.1 Reading Files; 13.2 Creating and Changing Files; 13.3 Moving, Copying, and Deleting Files; 13.4 Other File Functions; 13.5 Checking Whether a File Exists; 13.6 Retrieving File Time Information; 13.7 Dissecting Filename Information; 13.8 Handling File Uploads; 13.9 Locking Files with flock(); 13.10 Reading File Permissions and Status; 13.11 Changing File Permissions and Ownership; 13.12 Working with Links; 13.13 Working with Directories; 13.14 Remote Files; 13.15 File Checksums; 13.16 Parsing a Configuration File; Chapter 14: Databases; 14.1 Using MySQL with PHP; 14.2 PEAR::DB; 14.3 SQLite; 14.4 Persistent Connections; 14.5 MySQL Improved; Chapter 15: Regular Expressions; 15.1 Basic Regexps with preg_match() and preg_match_all(); 15.2 Regexp Character Classes; 15.3 Regexp Special Characters; 15.4 Words and Whitespace Regexps; 15.5 Storing Matched Strings; 15.6 Regular Expression Replacements; 15.7 Regular Expression Syntax Examples; 15.8 The Regular Expressions Coach; Chapter 16: Manipulating Images; 16.1 Getting Started; 16.2 Choosing a Format; 16.3 Getting Arty; 16.4 More Shapes; 16.5 Complex Shapes; 16.6 Outputting Text; 16.7 Loading Existing Images; 16.8 Color and Image Fills; 16.9 Adding Transparency; 16.10 Using Brushes; 16.11 Basic Image Copying; 16.12 Scaling and Rotating; 16.13 Points and Lines; 16.14 Special Effects Using imagefilter(); 16.15 Interlacing an Image; 16.16 Getting an Image's MIME Type; Chapter 17: Creating PDFs; 17.1 Getting Started; 17.2 Adding More Pages and More Style; 17.3 Adding Images; 17.4 PDF Special Effects; 17.5 Adding Document Data; Chapter 18: Creating Flash; 18.1 A Simple Movie; 18.2 Flash Text; 18.3 Actions; 18.4 Animation; Chapter 19: XML and XSLT; 19.1 SimpleXML; 19.2 Transforming XML Using XSLT; Chapter 20: Network Programming; 20.1 Sockets; 20.2 HTTP; 20.3 Sending Mail; 20.4 Curl; Chapter 21: Distributing Your Code; 21.1 Cross-Platform Code 1: Loading Extensions; 21.2 Cross-Platform Code 2: Using Extensions; 21.3 Cross-Platform Code 3: Path and Line Separators; 21.4 Cross-Platform Code 4: Coping with php.ini Differences; 21.5 Cross-Platform Code 5: Checking the PHP Version with phpversion() and version_compare(); Chapter 22: Debugging; 22.1 The Most Basic Debugging Technique; 22.2 Making Assertions; 22.3 Triggering Your Own Errors; 22.4 Testing with php_check_syntax(); 22.5 Source Highlighting; 22.6 Handling MySQL Errors; 22.7 Exception Handling; 22.8 Backtracing Your Code; 22.9 Custom Error Handlers; 22.10 Custom Exception Handlers; 22.11 Using @ to Disable Errors; 22.12 phpinfo(); 22.13 Output Style; Chapter 23: Performance; 23.1 Write Your Code Sensibly; 23.2 Use the Zend Optimizer; 23.3 Use a PHP Code Cache; 23.4 Compress Your Output; 23.5 Don't Use CGI; 23.6 Debug Your Code; 23.7 Use Persistent Connections; 23.8 Compile Right; Colophon;