You are previewing Core PHP Programming: Using PHP to Build Dynamic Web Sites.
O'Reilly logo
Core PHP Programming: Using PHP to Build Dynamic Web Sites

Book Description

  • Master PHP 4 — the open source Web scripting breakthrough

  • Contains expert coverage of syntax, functions, design, and debugging

  • Leverage the amazing performance of the new Zend engine!

  • 650+ real-world code examples

  • CD-ROM includes source code, plus everything you'll need to run PHP 4 implementations on Windows and UNIX

  • Foreword by Andi Gutmans

    Praise for the first edition:

    Core PHP Programming has proved itself an invaluable technical reference. I highly recommend it for beginners as well, since the official PHP manual often assumes too much knowledge on behalf of the user. Leon's strength is that he does not try to sound more technical than needed, simply for the sake of impressing other programmers. In short, a must-have for any PHP user, beginning or advanced!
    —Zack Beatty, Enterprise Web Engineer

    The experienced developer's guide to PHP!

    Master PHP 4, the open source, high-performance, cross-platform solution for server-side scripting!

    Core PHP Programming, Second Edition is the #1 practical guide to PHP 4 for Web developers. With the guidance of top PHP developer Leon Atkinson, you'll learn everything you'll need to build robust, fast Web applications — and deploy them on leading Web servers, from Apache to Microsoft Internet Information Server.

    Atkinson covers PHP syntax, the key building blocks of PHP scripts, and every PHP function, including I/O, data, and math functions, time, date, configuration, database, graphics, and network functions. He presents PHP at work in sample code that demonstrates sorting, searching, parsing, string evaluation, and more. You'll even find detailed, real-world insights into PHP 4 program design and debugging!

    Core PHP Programming delivers

  • Thorough, easy-to-understand coverage of PHP syntax and functions

  • Step-by-step guidance for PHP database integration

  • Design and optimization techniques for maximum performance and extensibility

  • Practical debugging solutions

  • CD-ROM includes PHP 4 source code and Windows binaries plus all the code examples from the book!

    Table of Contents

    1. Copyright
    2. Foreword
    3. Preface
    4. Acknowledgments
    5. PROGRAMMING WITH PHP
      1. AN INTRODUCTION TO PHP
        1. The Origins of PHP
        2. What Makes PHP Better than Its Alternatives
        3. Interfaces to External Systems
        4. How PHP Works with the Web Server
        5. Hardware and Software Requirements
        6. Installation on Apache for UNIX
        7. Installation on IIS for Windows NT
        8. Editing Scripts
        9. Algorithms
        10. What a PHP Script Looks Like
        11. Saving Data for Later
        12. Receiving User Input
        13. Choosing between Alternatives
        14. Repeating Code
        15. Conclusion
      2. VARIABLES, OPERATORS, AND EXPRESSIONS
        1. Identifiers
        2. Data Types
        3. Variable Creation and Scope
        4. Assigning Values to Variables
        5. Retrieving Values
        6. Freeing Memory
        7. Constants
        8. Operators
        9. Logical and Relational Operators
        10. Bitwise Operators
        11. Miscellaneous Operators
        12. Assignment Operators
        13. Expressions
      3. CONTROL STATEMENTS
        1. True and False
        2. The if Statement
        3. The ? Operator
        4. The switch Statement
        5. Loops
        6. The while Statement
        7. The break Statement
        8. The continue Statement
        9. The do...while Statement
        10. The for Statement
        11. The foreach Statement
        12. exit, die, and return
        13. Evaluation of Boolean Expressions
      4. FUNCTIONS
        1. Declaring a Function
        2. The return Statement
        3. Scope and the global Statement
        4. Arguments
        5. Recursion
        6. Dynamic Function Calls
      5. ARRAYS
        1. Single-Dimensional Arrays
        2. Indexing Arrays
        3. Initializing Arrays
        4. Multidimensional Arrays
        5. Casting Arrays
        6. Referencing Arrays Inside Strings
      6. CLASSES AND OBJECTS
        1. Defining a Class
        2. Creating an Object
        3. Accessing Properties and Methods
      7. I/O AND DISK ACCESS
        1. HTTP Connections
        2. Writing to the Browser
        3. Output Buffering
        4. Environment Variables
        5. Getting Input from Forms
        6. Cookies
        7. File Uploads
        8. PUT Method Requests
        9. Reading and Writing to Files
        10. Sessions
        11. The include and require Functions
    6. FUNCTIONAL REFERENCE
      1. I/O FUNCTIONS
        1. Sending Text to the Browser
        2. Output Buffering
        3. Files
        4. Compressed File Functions
        5. POSIX
        6. Debugging
        7. Session Handling
        8. Shell Commands
        9. HTTP Headers
        10. Network I/O
        11. FTP
      2. DATA FUNCTIONS
        1. Data Types, Constants, and Variables
        2. Arrays
        3. Hashing
        4. Strings
        5. Encoding and Decoding
        6. Encryption
        7. Regular Expressions
        8. Perl-Compatible Regular Expressions
      3. MATHEMATICAL FUNCTIONS
        1. Common Math
        2. Random Numbers
        3. Arbitrary-Precision Numbers
      4. TIME, DATE, AND CONFIGURATION FUNCTIONS
        1. Time and Date
        2. Alternative Calendars
        3. Configuration
      5. IMAGE FUNCTIONS
        1. Analyzing Images
        2. Creating JPEG, PNG, and WBMP Images
      6. DATABASE FUNCTIONS
        1. dBase
        2. DBM-style Database Abstraction
        3. filePro
        4. Informix
        5. InterBase
        6. mSQL
        7. MySQL
        8. ODBC
        9. Oracle
        10. Postgres
        11. Sybase
      7. MISCELLANEOUS FUNCTIONS
        1. Apache
        2. Aspell
        3. COM
        4. Gettext
        5. IMAP
        6. Java
        7. LDAP
        8. Semaphores
        9. Shared Memory
        10. SNMP
        11. WDDX
        12. XML
    7. ALGORITHMS
      1. SORTING, SEARCHING, AND RANDOM NUMBERS
        1. Sorting
        2. Bubble Sort
        3. Quicksort
        4. Built-In Sorting Functions
        5. Sorting with a Comparison Function
        6. Searching
        7. Indexing
        8. Random Numbers
        9. Random Identifiers
        10. Choosing Banner Ads
      2. PARSING AND STRING EVALUATION
        1. Tokenizing
        2. Regular Expressions
        3. Defining Regular Expressions
        4. Using Regular Expressions in PHP Scripts
      3. DATABASE INTEGRATION
        1. Building HTML Tables from SQL Queries
        2. Tracking Visitors with Session Identifiers
        3. Storing Content in a Database
        4. Database Abstraction Layers
      4. NETWORK
        1. HTTP Authentication
        2. Controlling Browser Cache
        3. Setting Document Type
        4. Email with Attachments
        5. Verifying an Email Address
      5. GENERATING GRAPHICS
        1. Dynamic Buttons
        2. Generating Graphs on the Fly
        3. Bar Graphs
        4. Pie Charts
        5. Stretching Single-Pixel Images
    8. SOFTWARE ENGINEERING
      1. INTEGRATION WITH HTML
        1. Sprinkling PHP within an HTML Document
        2. Using PHP to Output All HTML
        3. Separating HTML from PHP
        4. Creating <SELECT> Fields
        5. Passing Arrays in Forms
      2. DESIGN
        1. Writing Requirements Specifications
        2. Writing Design Documents
        3. Using CVS
        4. Modularization Using include
        5. FreeEnergy
        6. FastTemplate
        7. Midgard
        8. Ariadne
        9. Preserving State and Providing Security
        10. Cloaking
        11. URLs Friendly to Search Engines
        12. Running a Script Regularly
      3. EFFICIENCY AND DEBUGGING
        1. Measuring Performance
        2. Fetching Database Query Results
        3. When to Store Content in a Database
        4. In-Line Debugging
        5. Remote Debugging
        6. Simulating HTTP Connections
    9. BACKSLASH CODES
    10. ASCII CODES
    11. OPERATORS
    12. PHP TAGS
    13. PHP COMPILE-TIME CONFIGURATION
    14. INTERNET RESOURCES
      1. Portals
      2. Software
      3. Jobs and Services
    15. PHP STYLE GUIDE
      1. Comments
      2. Function Declarations
      3. Compound Statements
      4. Naming
      5. Expressions