Example: bachelor of science

PHP 5 Power Programming

PHP 5 Power Programming Gutmans_Frontmatter Page i Thursday, September 23, 2004 9:05 AMBRUCE PERENS OPEN SOURCE Java Application Development on LinuxCarl Albing and Michael Schwarz C++ GUI Programming with Qt 3 Jasmin Blanchette, Mark Summerfield Managing Linux Systems with Webmin: System Administration and Module DevelopmentJamie Cameron Understanding the Linux Virtual Memory ManagerMel Gorman Implementing CIFS: The Common Internet File SystemChristopher Hertel Embedded Software Development with eCosAnthony Massa Rapid Application Development with MozillaNigel McFarlane The Linux Development Platform: Configuring, Using, and Maintaining a Complete Programming EnvironmentRafeeq Ur Rehman, Christopher Paul Intrusion Detection with SNORT: Advanced IDS Techniques Using SNORT, Apache, MySQL, PHP, and ACIDR afeeq Ur Rehman The Official Samba-3 HOWTO and Reference Guide John H. Terpstra, Jelmer R. Vernooij, Editors Samba-3 by Example: Practical Exercises to Successful DeploymentJohn H.

PRENTICE HALL Professional Technical Reference Indianapolis, IN 46240 www.phptr.com PHP 5 Power Programming Andi Gutmans, Stig Sæther Bakken, and Derick Rethans

Tags:

  Programming

Information

Domain:

Source:

Link to this page:

Please notify us if you found a problem with this document:

Other abuse

Transcription of PHP 5 Power Programming

1 PHP 5 Power Programming Gutmans_Frontmatter Page i Thursday, September 23, 2004 9:05 AMBRUCE PERENS OPEN SOURCE Java Application Development on LinuxCarl Albing and Michael Schwarz C++ GUI Programming with Qt 3 Jasmin Blanchette, Mark Summerfield Managing Linux Systems with Webmin: System Administration and Module DevelopmentJamie Cameron Understanding the Linux Virtual Memory ManagerMel Gorman Implementing CIFS: The Common Internet File SystemChristopher Hertel Embedded Software Development with eCosAnthony Massa Rapid Application Development with MozillaNigel McFarlane The Linux Development Platform: Configuring, Using, and Maintaining a Complete Programming EnvironmentRafeeq Ur Rehman, Christopher Paul Intrusion Detection with SNORT: Advanced IDS Techniques Using SNORT, Apache, MySQL, PHP, and ACIDR afeeq Ur Rehman The Official Samba-3 HOWTO and Reference Guide John H. Terpstra, Jelmer R. Vernooij, Editors Samba-3 by Example: Practical Exercises to Successful DeploymentJohn H.

2 Terpstra Page 1 Wednesday, September 15, 2004 10:54 AM Gutmans_Frontmatter Page ii Thursday, September 23, 2004 9:05 AM PRENTICE HALLP rofessional Technical ReferenceIndianapolis, IN PHP 5 Power Programming Andi Gutmans, Stig S ther Bakken, and Derick Rethans Gutmans_Frontmatter Page iii Thursday, September 23, 2004 9:05 AM The authors and publisher have taken care in the preparation of this book, but make no expressed or impliedwarranty of any kind and assume no responsibility for errors or omissions. No liability is assumed for inciden-tal or consequential damages in connection with or arising out of the use of the information or programs con-tained : John Wait Editor in Chief: Don O Hagan Acquisitions Editor: Mark L. Taub Editorial Assistant: Noreen Regina Development Editor: Janet Valade Marketing Manager: Robin O'Brien Cover Designer: Nina Scuderi Managing Editor: Gina Kanouse Senior Project Editor: Kristy Hart Copy Editor: Specialized Composition Indexer: Lisa Stumpf Senior Compositor: Gloria Schurick Manufacturing Buyer: Dan Uhrig The publisher offers excellent discounts on this book when ordered in quantity for bulk purchases or specialsales, which may include electronic versions and/or custom covers and content particular to your business,training goals, marketing focus, and branding interests.

3 For more information, please contact:U. S. Corporate and Government Sales(800) sales outside the U. S., please contact:International us on the Web: of Congress Cataloging-in-Publication Data:2004107331 Copyright 2005 Pearson Education, material may be distrubuted only subject to the terms and conditions set forth in the Open PublicationLicense, or later (the latest version is presently available at ).Pearson Education, Lake StreetUpper Saddle River, NJ 07458 Every effort was made to contact and credit all copyright holders. Use of material without proper credit is 0-131-47149-XText printed in the United States on recycled paper at Phoenix in Hagerstown, printing, [October 2004] Gutmans_Frontmatter Page iv Thursday, September 23, 2004 2:14 PM To Ifat, my wife and best friend, who has patiently put up with my involement in PHP from the very beginning, and has encouraged and supported me every step of the GutmansTo Marianne, for patience and S ther BakkenTo my parents, who care for me even when I m not around; and to 42, the answer to life, the universe of Rethans Gutmans_Frontmatter Page v Thursday, September 23, 2004 9:05 AM Gutmans_Frontmatter Page vi Thursday, September 23, 2004 9:05 AM vii Contents Foreword by Zeev SuraskiPreface: Introduction and BackgroundChapter 1: What Is New in PHP 5?

4 Chapter 2: PHP 5 Basic Language Chapter 3: PHP 5 OO Language Chapter 4: PHP 5 Advanced OOP and Design Patterns Chapter 5: How to Write a Web Application with PHP Chapter 6: Databases with PHP 5 Chapter 7: Error Handling Chapter 8: XML with PHP 5 Chapter 9: Mainstream Extensions Chapter 10: Using PEAR Chapter 11: Important PEAR Packages Chapter 12: Building PEAR Components Chapter 13: Making the Move Chapter 14: Performance Chapter 15: An Introduction to Writing PHP Extensions Chapter 16: PHP Shell Scripting A. PEAR and PECL Package Index B. phpDocumentor Format Reference C. Zend Studio Quick Start Index Gutmans_Frontmatter Page vii Thursday, September 23, 2004 9:05 AM Gutmans_Frontmatter Page viii Thursday, September 23, 2004 9:05 AM ix Contents Foreword .. xxiPreface .. xxii1 What Is New in PHP 5? .. 1 Introduction.

5 Language Features .. New Object-Oriented New Object-Oriented Features .. Other New Language Features .. General PHP XML and Web Services .. Other New Features in PHP 5 .. New Memory Dropped Support for Windows Summary .. 11 2 PHP 5 Basic Language ..13 Introduction .. HTML Embedding .. Comments .. Indirect References to Variables .. Managing Variables .. Superglobals .. Basic Data Types .. Integers .. Floating-Point Numbers .. Booleans .. Null .. 23 Gutmans_TOC Page ix Thursday, September 23, 2004 9:06 AM x Contents Resources .. Arrays .. Constants .. Operators .. Binary Operators .. Assignment Comparison Operators .. Logical Operators .. Bitwise Operators .. Unary Operators .. Negation Operators .. Increment/Decrement Operators .. The Cast Operators .. The Silence Operator .. The One and Only Ternary Operator .. Control Structures .. Conditional Control Loop Control Structures.

6 Code Inclusion Control Structures .. Functions .. User-Defined Functions .. Function Returning Values By Value .. Returning Values By Reference .. Declaring Function Static Variables .. Summary ..54 3 PHP 5 OO Language .. 55 Objects .. Declaring a Class .. The new Keyword and Constructors .. Destructors .. Accessing Methods and Properties Using the $this public , protected , and private Properties .. public , protected , and private Methods .. Static Properties .. Static Methods .. Class Cloning Objects .. parent :: and self ::.. instanceof Operator ..71 Gutmans_TOC Page x Thursday, September 23, 2004 9:06 AM Contentsxi Abstract Methods and Classes .. Interfaces .. Inheritance of Interfaces .. final Methods .. final Classes .. __toString() Exception Handling .. __autoload() .. Class Type Hints in Function Parameters .. Summary .. 83 4 PHP 5 Advanced OOP and Design Patterns.

7 85 Introduction .. Overloading Property and Method Overloading .. Overloading the Array Access Iterators .. Design Patterns .. Strategy Singleton Pattern .. Factory Pattern .. Observer Pattern .. Introduction .. Reflection Reflection Examples .. Implementing the Delegation Pattern Using Summary .. 109 5 How to Write a Web Application with Introduction .. Embedding into HTML .. User Input .. Safe-Handling User Common Mistakes .. Techniques to Make Scripts Safe .. Input Validation .. HMAC Input Filter .. Working with Passwords .. Error Handling .. Cookies .. Sessions .. 134 Gutmans_TOC Page xi Thursday, September 23, 2004 9:06 AM xii Contents File Uploads .. Handling the Incoming Uploaded File .. One Script Serves All .. One Script per Function .. Separating Logic from Layout .. Summary ..146 6 Databases with PHP 5 .. 149 MySQL Strengths and Weaknesses.

8 PHP Interface .. Example Data .. Connections .. Buffered Versus Unbuffered Queries .. Queries .. Multi Statements .. Fetching Modes .. Prepared BLOB Handling .. SQLite Strengths and Weaknesses .. Best Areas of PHP Interface .. PEAR DB .. Obtaining PEAR DB .. Pros and Cons of Database Abstraction .. Which Features Are Abstracted? .. Database Connections .. Executing Queries .. Fetching Results .. Sequences .. Portability Features .. Abstracted Errors .. Convenience Methods .. Summary ..190 7 Error 191 Types of Errors .. Programming Errors .. Undefined Symbols .. Portability Errors ..197 Gutmans_TOC Page xii Thursday, September 23, 2004 9:06 AM Contentsxiii Runtime PHP Errors .. PEAR Errors .. The PEAR_Error Class .. Handling PEAR Errors .. PEAR Error Graceful Handling .. Exceptions .. What Are Exceptions? .. try, catch, and throw .. Summary .. 218 8 XML with PHP 5 ..219 Introduction.

9 Parsing XML .. SAX .. DOM .. SimpleXML .. Creating a SimpleXML Browsing SimpleXML Objects .. Storing SimpleXML Objects .. PEAR .. XML_Tree .. Converting XML .. XSLT .. Communicating with SOAP .. Summary .. 259 9 Mainstream Extensions ..261 Introduction .. Files and Streams .. File Access .. Program Input/Output .. Input/Output Compression Streams .. User Streams .. URL Streams .. Locking .. Renaming and Removing Files .. Temporary Files .. 278 Gutmans_TOC Page xiii Thursday, September 23, 2004 9:06 AM xiv Contents Regular Expressions .. Syntax .. Date Handling .. Retrieving Date and Time Information .. Formatting Date and Time .. Parsing Date Formats .. Graphics Manipulation with Case 1: Bot-Proof Submission Forms .. Case 2: Bar Chart .. Exif .. Multi-Byte Strings and Character Sets .. Character Set Extra Functions Dealing with Multi-Byte Character Sets.

10 Locales .. Summary ..343 10 Using 345 PEAR Concepts .. Version Numbers .. Obtaining Installing with UNIX / Linux PHP Distribution .. Installing with PHP Windows Installer .. Installing Packages .. Using the pear Command .. Configuration Parameters .. PEAR pear install .. pear list .. pear info .. pear list-all .. pear list-upgrades .. pear upgrade .. pear upgrade-all .. pear uninstall .. pear search .. pear remote-list .. pear remote-info .. pear download .. pear config-get ..376 Gutmans_TOC Page xiv Thursday, September 23, 2004 9:06 AM Contentsxv pear config-set .. pear config-show .. Installer CLI (Command Line Interface) Installer .. Gtk Installer .. Summary .. 381 11 Important PEAR Packages ..383 Introduction .. Database Template Systems .. Template Terminology .. HTML_Template_IT .. HTML_Template_Flexy .. Authentication .. Overview .. Example: Auth with Password Example: Auth with DB and User Data.


Related search queries