Cover image for PHP: The Good Parts

Book description

Get past all the hype about PHP and dig into the real power of the language. PHP: The Good Parts gives you look at the most useful features of PHP, and explains how you can speed up the web development process with them. You'll learn why the most commonly used PHP features are often misused or misapplied, and which features add strength to object-oriented programming. You'll also focus on aspects that will help you integrate your application with databases.

Table of Contents

  1. Dedication
  2. Special Upgrade Offer
  3. A Note Regarding Supplemental Files
  4. Foreword
  5. Preface
    1. Conventions Used in This Book
    2. Using Code Examples
    3. How to Contact Us
    4. Safari® Books Online
    5. Acknowledgments
  6. 1. The Good Parts
    1. Why PHP?
      1. A Brief History of PHP
      2. PHP’s Place in the World
      3. What Is PHP?
      4. What Has Been Accomplished with PHP?
    2. Basic PHP Setup
  7. 2. Casing the Joint
    1. Whitespace, Comments, and Basic Syntax
    2. Variables: Data Types, Loose Typing, and Scope
    3. Defined Constants
    4. Expressions
    5. Decisions, Decisions (Flow Control)
      1. If...Else...
      2. Switch...Case...
      3. While...
      4. For
    6. Integration with Web Pages
      1. Cookies
      2. Sessions
      3. $_GET
      4. $_POST
      5. $_REQUEST
  8. 3. Functions (Doing It Once)
    1. Parameter Passing
    2. Default Parameters
    3. Passing by Value Versus Passing by Reference
    4. Include and Require
    5. Built-In Functions Versus UDFs
  9. 4. Strings
    1. What Is a String?
    2. You Can Quote Me
    3. String Functions (Best of)
      1. String Trimmings
      2. Character Case Management
      3. String Content Searching
      4. String Modification
  10. 5. Arrays
    1. Indexed Arrays
    2. Associative Arrays
    3. Arrays from Another Dimension
    4. Arrays Can Be Dynamic
    5. Traversing Arrays
    6. Array Functions (Best of)
      1. Sorting Arrays
      2. Math-Type Functions
      3. Array Potpourri
  11. 6. Objects
    1. Putting It into Practice
    2. Magic Methods
    3. $this
    4. Objects in Action
    5. Public, Protected, and Private
    6. Getters and Setters
  12. 7. Database Interaction
    1. MySQLi Object Interface
    2. Retrieving Data for Display
    3. PHP Data Objects
    4. PDO Prepared Statements
    5. Data Management on the Cheap
      1. SQLite
    6. File Management As a Database Alternative
  13. 8. PHP and Friends
    1. Email/SMS Generation
    2. PDF Generation
      1. Constructor Method and Basic Document Options
      2. Adding Document Headers and Footers
      3. Adding Images and Links
      4. Adding a Watermark
      5. Dynamic PDFs and Table Display
    3. Graphical Reports Generation
      1. Pie Charts
      2. Bar Charts
      3. Captchas
  14. 9. PHP Security
    1. Data Validation
    2. Escape Output
    3. Cross-Site Scripting (XXS) and SQL Injection
    4. Password Encryption Security
    5. Security Tips
  15. 10. PHP 5.3 Good Parts
    1. Namespaces
    2. Closures (Anonymous Functions)
    3. NOWDOC
    4. goto Operator
    5. DateTime and DateTimeZone Classes
    6. Additional 5.3 Features
  16. 11. Advanced Goodness
    1. Regular Expressions
      1. String Matching
      2. String Substituting
      3. String Splitting
    2. SimpleXML
    3. Integrated Development Environments
      1. Komodo by ActiveState
      2. Zend Studio for Eclipse
      3. PhpED by NuSphere
    4. Primary Websites
      1. php.net
      2. zend.com
      3. devzone.zend.com
      4. phparch.com
      5. PHP/Web Conferences
  17. A. The Bad Parts
    1. goto
    2. Function Naming and Parameter Order
    3. Loose Typing
    4. Register Globals
    5. Is That All?
  18. Index
  19. About the Author
  20. Colophon
  21. Special Upgrade Offer
  22. Copyright