Synopses & Reviews
If you're using PHP 4, then chances are good that an upgrade to PHP 5 is in your future. The more you've heard about the exciting new features in PHP 5, the sooner that upgrade is probably going to be. Although an in-depth, soup-to-nuts reference guide to the language is good to have on hand, it's not the book an experienced PHP programmer needs to get started with the latest release. What you need is a lean and focused guide that answers your most pressing questions: what's new with the technology, what's different, and how do I make the best use of it? In other words, you need a copy of Upgrading to PHP 5.This book is targeted toward PHP developers who are already familiar with PHP 4. Rather than serve as a definitive guide to the entire language, the book zeroes in on PHP 5's new features, and covers these features definitively. You'll find a concise appraisal of the differences between PHP 4 and PHP 5, a detailed look at what's new in this latest version, and you'll see how PHP 5 improves on PHP 4 code. See PHP 4 and PHP 5 code side-by-side, to learn how the new features make it easier to solve common PHP problems. Each new feature is shown in code, helping you understand why it's there, when to use it, and how it's better than PHP 4. Short, sample programs are included throughout the book.Topics covered in Upgrading to PHP 5 include:
Upgrading to PHP 5
- The new set of robust object-oriented programming features
- An improved MySQL extension, supporting MySQL 4.1, prepared statements, and bound parameters
- Completely rewritten support for XML: DOM, XSLT, SAX, and SimpleXML
- Easy web services with SOAP
- SQLite, an embedded database library bundled with PHP 5
- Cleaner error handling with exceptions
- Other new language features, such as iterators, streams, and more.
won't make you wade through information you've covered before. Written by Adam Trachtenberg, coauthor of the popular PHP Cookbook
, this book will take you straight into the heart of all that's new in PHP 5. By the time you've finished, you'll know PHP 5 in practice as well as in theory.
- Covers the newest release of PHP, version 5
- Written by the co-author of the popular PHP Cookbook
- Includes in-depth coverage of all the new features, plus advanced topics
This book is targeted toward PHP developers who are already familiar with PHP 4. Rather than serve as a definitive guide to the entire language, the book zeroes in on PHP 5's new features, and covers these features definitively. You'll find a concise appraisal of the differences between PHP 4 and PHP 5, a detailed look at what's new in this latest version, and you'll see how PHP 5 improves on PHP 4 code. See PHP 4 and PHP 5 code side-by-side, to learn how the new features make it easier to solve common PHP problems. Each new feature is shown in code, helping you understand why it's there, when to use it, and how it's better than PHP 4. Short, sample programs are included throughout the book. Short, sample programs are included throughout the book. By the time you've finished, you'll know PHP 5 in practice as well as in theory.
About the Author
Adam Trachtenberg has an MBA from Columbia Business School. At business school, he focused on general management and operations, with an emphasis on the field of technology. Adam also has a BA from Columbia University. As an undergraduate, he majored in mathematics and his other studies included computer science and Chinese. Before returning to school, he co-founded and served as Vice President for Development at two companies, Student.Com and TVGrid.Com. At both firms, he led the front- and middle-end web site design and development, worked on corporate planning and strategy, and served as liaison between the product and marketing teams. During study breaks, Adam enjoys playing squash, reading fiction, and eating in New York City's many wonderful restaurants. He wishes he was a better at playing pool, knew the constellations, and was handy around the house.
Table of Contents
Preface; Who This Book Is For; Who This Book Is Not For; What's in This Book; Other Resources; Conventions Used in This Book; Using Code Examples; We'd Like to Hear from You; Acknowledgements; Chapter 1: Introduction; 1.1 Why PHP 5?; 1.2 What's New in PHP 5?; 1.3 Installing and Configuring PHP 5; Chapter 2: Object-Oriented Programming; 2.1 What Is Object-Oriented Programming?; 2.2 Memory Management; 2.3 Basic Classes; 2.4 Class Intermediates; 2.5 Inheritance; 2.6 Magical Methods; Chapter 3: MySQL; 3.1 Installing and Configuring; 3.2 Procedural Interface; 3.3 Before and After: Connecting to the Database Server; 3.4 Object-Oriented Interface; 3.5 Before and After: Querying and Retrieving Data with Prepared Statements; 3.6 Before and After: Subselects; 3.7 Transactions; 3.8 Before and After: Making Multiple Queries; 3.9 Securing Connections with SSL; 3.10 Porting Code and Migrating Databases; Chapter 4: SQLite; 4.1 SQLite Basics; 4.2 Alternate SQLite Result Types; 4.3 Object-Oriented Interface; 4.4 Indexes, Error Handling, and In-Memory Tables; 4.5 Transactions; 4.6 User-Defined Functions; Chapter 5: XML; 5.1 XML Extensions in PHP 5; 5.2 Installing XML and XSLT Support; 5.3 DOM; 5.4 SimpleXML; 5.5 Converting Between SimpleXML and DOM Objects; 5.6 Before and After: Reading XML into a Tree; 5.7 Before and After: Searching XML with XPath; 5.8 Reading XML as Events with SAX; 5.9 Before and After: Creating New XML Documents; 5.10 Before and After: Transforming XML with XSLT; 5.11 Validating Against a Schema; Chapter 6: Iterators and SPL; 6.1 Before and After: Using Iterators; 6.2 Implementing the Iterator Interface; 6.3 MySQL Query Iterator; 6.4 Chaining Iterators; 6.5 SimpleXML Iterator; 6.6 Before and After: Recursive Directory Iteration; 6.7 Implementing the RecursiveIterator Interface; 6.8 Array and Object Property Iteration; 6.9 Redefining Class Iteration; 6.10 Iterator and SPL Classes and Interfaces; Chapter 7: Error Handling and Debugging; 7.1 Before and After: Handling Errors; 7.2 The Benefits of Exceptions; 7.3 System Exceptions; 7.4 The Exception Class; 7.5 User Exceptions; 7.6 Setting a Custom Exception Handler; 7.7 Processing Errors with a Custom Handler; 7.8 Debugging Functions; Chapter 8: Streams, Wrappers, and Filters; 8.1 Using the Streams API; 8.2 Wrapper Overview; 8.3 Wrapper Details; 8.4 Creating Wrappers; 8.5 Filtering Streams; 8.6 Creating Filters; Chapter 9: Other Extensions; 9.1 SOAP; 9.2 Tidy; 9.3 Reflection; Chapter 10: PHP 5 in Action; 10.1 Defining Your Database Schema; 10.2 The Person Class; 10.3 The addressBook Class; 10.4 The Template Class; 10.5 Assembling the Application; 10.6 Wrap-Up and Future Directions; Introduction to XML; Comparing HTML and XML; Well-Formed XML; Schemas; Transformations; XML Namespaces; XPath; Additional New Features and Minor Changes; Passing Optional Parameters by Reference; New E_STRICT Error Setting; Treating Strings as Arrays Causes Errors; CLI Now Allows Individual Line Processing; CLI Always Provides argv and argc; Oracle (oci8) Extension Functions Renamed; New Configuration Directives; Updated COM Extension; Apache 2 Correctly Sets PATH_TRANSLATED; strrpos( ) Uses the Entire Needle; Windows 95 Support Dropped; old_function Eliminated; Installing PHP 5 Alongside PHP 4; General PHP 5 Configuration; Module and CGI; Windows; Colophon;