Welcome to Scribd, the world's digital library. Read, publish, and share books and documents. See more
Buy Now $39.99
Standard view
Full view
of .
Look up keyword or section
Like this
36Activity

Table Of Contents

The Evolution of PHP
What’s New in PHP 5.3
Namespaces
The goto Operator
Nowdoc Syntax
Shorthand Form of the Ternary Operator
Advanced Changes
Summary
Installing PHP
Installing on Ubuntu Linux
Installing on Windows
Installing on Mac OS X
Testing Your Installation
Setting Your Time Zone
Other Ways to Run PHP
Running PHP with other Web Servers
Compiling PHP Yourself
Running PHP Remotely
Creating Your First Script
Embedding PHP within HTML
Enhancing the Script Further
Using Comments to Make Code More Readable
Using Variables in PHP
Naming Variables
Creating Variables
Understanding Data Types
About Loose Typing
Testing the Type of a Variable
Changing a Variable ’ s Data Type
Changing Type by Casting
Operators and Expressions
Operator Types
Understanding Operator Precedence
Constants
Making Decisions
Simple Decisions with the if Statement
Providing an Alternative Choice with the else Statement
Testing One Expression Many Times with the switch Statement
Compact Coding with the Ternary Operator
Doing Repetitive Tasks with Looping
Simple Looping with the while Statement
Testing at the End: The do . . . while Loop
Neater Looping with the for Statement
Escaping from Loops with the break Statement
Skipping Loop Iterations with the continue Statement
Creating Nested Loops
Mixing Decisions and Looping with HTML
Creating and Accessing Strings
Including More Complex Expressions within Strings
Using Your Own Delimiters
Other Ways to Create Strings
Finding the Length of a String
Accessing Characters within a String
Searching Strings
Searching Strings with strstr()
Locating Text with strpos() and strrpos()
Finding the Number of Occurrences with substr_count()
Searching for a Set of Characters with strpbrk()
Replacing Text within Strings
Replacing All Occurrences using str_replace()
Replacing a Portion of a String with substr_replace()
Translating Characters with strtr()
Dealing with Upper - and Lowercase
Formatting Strings
General - Purpose Formatting with printf() and sprintf()
Trimming Strings with trim(), ltrim(), and rtrim()
Padding Strings with str_ pad()
Wrapping Lines of Text with wordwrap()
Formatting Numbers with number_format()
The Anatomy of an Array
Creating Arrays
Accessing Array Elements
Changing Elements
Outputting an Entire Array with print_r()
Extracting a Range of Elements with array_slice()
Counting Elements in an Array
Stepping Through an Array
Looping Through Arrays with foreach
Using foreach to Loop Through Values
Using foreach to Loop Through Keys and Values
Altering Array Values with foreach
Working with Multidimensional Arrays
Creating a Multidimensional Array
Accessing Elements of Multidimensional Arrays
Looping Through Multidimensional Arrays
Manipulating Arrays
Sorting Arrays
Adding and Removing Array Elements
Merging Arrays Together
Converting Between Arrays and Strings
Converting an Array to a List of Variables
What Is a Function?
Why Functions Are Useful
Calling Functions
Working with Variable Functions
Writing Your Own Functions
Defining Parameters
Optional Parameters and Default Values
Returning Values from Your Functions
Understanding Variable Scope
Creating Anonymous Functions
Working with References
Passing References to Your Own Functions
Returning References from Your Own Functions
Writing Recursive Functions
What Is Object - Oriented Programming?
Advantages of OOP
Understanding Basic OOP Concepts
Classes
Objects
Properties
Methods
Creating Classes and Objects in PHP
Creating and Using Properties
Understanding Property Visibility
Declaring Properties
Accessing Properties
Static Properties
Class Constants
Working with Methods
Method Visibility
Creating a Method
Calling Methods
Adding Parameters and Returning Values
Accessing Object Properties from Methods
Static Methods
Using Hints to Check Method Arguments
Making Your Classes Self - Contained with Encapsulation
Overloading Property Accesses with __get() and __set()
Overloading Method Calls with __call()
Other Overloading Methods
Using Inheritance to Extend the Power of Objects
Overriding Methods in the Parent Class
Preserving the Functionality of the Parent Class
Blocking Inheritance and Overrides with Final Classes and Methods
Using Abstract Classes and Methods
Working with Interfaces
Constructors and Destructors
Setting Up New Objects with Constructors
Cleaning Up Objects with Destructors
Automatically Loading Class Files
Storing Objects as Strings
Determining an Object ’ s Class
How HTML Forms Work
Capturing Form Data with PHP
Dealing Securely with Form Data
Handling Empty Form Fields
Dealing with Multi - Value Fields
Generating Web Forms with PHP
Storing PHP Variables in Forms
Creating File Upload Forms
Accessing Information on Uploaded Files
Limiting the Size of File Uploads
Storing and Using an Uploaded File
Redirecting after a Form Submission
Saving State with Query Strings
Building Query Strings
Accessing Data in Query Strings
Working with Cookies
Cookie Components
Setting a Cookie in PHP
Accessing Cookies in Your Scripts
Removing Cookies
Using PHP Sessions to Store Data
Creating a Session
Reading and Writing Session Data
Destroying a Session
Passing Session IDs in Query Strings
Changing Session Behavior
Understanding Files and Directories
Getting Information on Files
Time - Related Properties
Retrieving a Filename from a Path
Opening and Closing Files
Opening a File with fopen()
Closing a File with fclose()
Reading and Writing to Files
Reading and Writing Strings of Characters
Testing for the End of a File
Reading One Line at a Time
Reading CSV Files
Reading and Writing Entire Files
Random Access to File Data
Working with File Permissions
Changing Permissions
Checking File Permissions
Copying, Renaming, and Deleting Files
Working with Directories
Other Directory Functions
Working with Directory Objects
Telling a File from a Directory
Building a Text Editor
The Text Editor Script
Testing the Editor
Examining the Editor Code
Exercise
Deciding How to Store Data
Database Architectures
Database Models
Choosing a Database
Understanding Relational Databases
Normalization
Talking to Databases with SQL
Setting Up MySQL
Starting the MySQL Server
Setting Up the MySQL root Password
A Quick Play with MySQL
Creating a New Database
Creating a Table
Adding Data to a Table
Reading Data from a Table
Updating Data in a Table
Deleting Data from a Table
Deleting Tables and Databases
Connecting to MySQL from PHP
Making a Connection
Reading Data
Setting Up the Book Club Database
The BINARY Attribute and Collations
The UNIQUE Constraint
The ENUM Data Type
The TIMESTAMP Data Type
Retrieving Data with SELECT
Limiting the Number of Rows Returned
Sorting Results
Using Pattern Matching for Flexible Queries
Summarizing Data
Eliminating Duplicate Results
Grouping Results
Pulling Data from Multiple Tables
Using Aliases
Other Useful MySQL Operators and Functions
Creating a Member Record Viewer
Creating the config.php File
Creating the common.inc.php File
Creating the DataObject Class File
Building the Member Class
Building the LogEntry Class
Creating the view_members.php Script
Creating the view_member.php Script
Testing the Application
Inserting Records
Updating Records
Deleting Records
Building a Member Registration Application
Adding More Common Code
Enhancing the Member Class
Creating the Registration Script
Creating a Members ’ Area
Adding an Authentication Method to the Member Class
Enhancing the LogEntry Class to Record Page Views
Writing the Login Page Script
Creating a Logout Function
Creating the Pages for the Members ’ Area
Testing the Members ’ Area
Creating a Member Manager Application
Adding Update and Delete Methods to the Member Class
Adding a Deletion Method to the LogEntry Class
Tweaking the view_members.php Script
Testing the Member Manager
Installing PEAR Packages
Testing the PEAR Package Manager on Ubuntu
Testing PEAR using Mac OS X and MAMP
Installing and Testing PEAR with WampServer on Windows
Installing a Package
Installing Dependencies
Uninstalling Packages
Using Validation Rules
Working with Dates and Times
Understanding Timestamps
Getting the Current Date and Time
Creating Your Own Timestamps
Extracting Date and Time Values from a Timestamp
Formatting Date Strings
Checking Date Values
Working with Microseconds
DateTime: The Future of PHP Date/Time Handling
Working with HTTP
Understanding HTTP Requests
Exploring HTTP Responses
Modifying an HTTP Response
Getting Information from the Web Server
Sending Email
Specifying the Sender Address and Adding Headers
Controlling the Return Path Email Address
Sending HTML Emails
Basics of Computer Graphics
Color Theory
Coordinate Systems
Image Types
Creating Images
Creating a New Image
Allocating Colors
Outputting Images
Drawing in an Image
Manipulating Images
Opening an Existing Image
Applying a Watermark
Matching Literal Characters
Matching Types of Characters using Character Classes
Matching Multiple Characters
Using Subpatterns to Group Patterns
Referring to Previous Subpattern Matches
Matching Alternative Patterns
Using Anchors to Match at Specified Positions
Finding Multiple Matches with preg_match_all()
Searching Arrays with preg_grep()
Replacing Text
Replacing Text with preg_replace()
Replacing Text using a Callback Function
Altering Matching Behavior with Pattern Modifiers
Splitting a String with a Regular Expression
What Is XML?
XML Document Structure
Major Parts of an XML Document
XML Syntax Rules
Using XML Elements and Attributes
Valid XML Documents: DTDs and XSDs
Reading XML Documents with PHP
How XML Parser Works
Creating a New Parser
Creating Event Handlers
Parsing the XML Document
Dealing with Parse Errors
Writing and Manipulating XML Documents with PHP
DOM Basics
Creating an XML Document using the DOM
Manipulating XML Documents using the DOM
Doing XML the Easy Way with SimpleXML
Reading an XML Document
Creating an XML Document
Converting Between SimpleXML and DOM Objects
Working with XSL and XSLT
Writing Modular Code
Including Files
Including a File Only Once
Working with Include Paths
Dynamic Includes
Using Namespaces to Avoid Clashes
Using Coding Standards for Consistency
Documenting Your Code
Writing Good Comments
Using phpDocumentor to Generate External Documentation
Checking Input and Encoding Output
Checking Input
Encoding Output
Handling Errors
Understanding Error Levels
Triggering Errors
Controlling Where Error Messages Are Sent
Logging Your Own Error Messages
Letting Your Script Handle Errors
Fine - Tuning Error Reporting
Using Exception Objects to Handle Errors
Separating Application Logic from Presentation Logic
Automated Code Testing with PHPUnit
Index
P. 1
Beginning PHP 5.3

Beginning PHP 5.3

Ratings:

5.0

(1)
|Views: 3,061|Likes:
Published by Wiley
This book is intended for anyone starting out with PHP programming.If you’ve previously worked in another programming languagesuch as Java, C#, or Perl, you’ll probably pick up theconcepts in the earlier chapters quickly; however, the book assumesno prior experience of programming or of building Web applications.

That said, because PHP is primarily a Web technology, it willhelp if you have at least some knowledge of other Web technologies,particularly HTML and CSS.

Many Web applications make use of a database to store data, andthis book contains three chapters on working with MySQL databases.Once again, if you’re already familiar with databases ingeneral — and MySQL in particular — you’ll beable to fly through these chapters. However, even if you’venever touched a database before in your life, you should still beable to pick up a working knowledge by reading through thesechapters.

This book is intended for anyone starting out with PHP programming.If you’ve previously worked in another programming languagesuch as Java, C#, or Perl, you’ll probably pick up theconcepts in the earlier chapters quickly; however, the book assumesno prior experience of programming or of building Web applications.

That said, because PHP is primarily a Web technology, it willhelp if you have at least some knowledge of other Web technologies,particularly HTML and CSS.

Many Web applications make use of a database to store data, andthis book contains three chapters on working with MySQL databases.Once again, if you’re already familiar with databases ingeneral — and MySQL in particular — you’ll beable to fly through these chapters. However, even if you’venever touched a database before in your life, you should still beable to pick up a working knowledge by reading through thesechapters.

More info:

Publish date: Nov 19, 2009
Added to Scribd: Feb 06, 2010
Copyright:Traditional Copyright: All rights reservedISBN:9780470543535
List Price: $39.99 Buy Now

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
This book can be read on up to 6 mobile devices.
See more
See less

02/17/2015

841

9780470543535

$39.99

USD

You're Reading a Free Preview
Pages 17 to 485 are not shown in this preview.
You're Reading a Free Preview
Pages 502 to 564 are not shown in this preview.
You're Reading a Free Preview
Pages 581 to 761 are not shown in this preview.
You're Reading a Free Preview
Pages 780 to 841 are not shown in this preview.

Activity (36)

You've already reviewed this. Edit your review.
Vinicius Fortino liked this
1 thousand reads
1 hundred reads
dkishore liked this
Yassine Hsn liked this
Lorivic Cua liked this
jalham liked this
Patar Silalahi liked this
Saurabh Kumar liked this
roderinde liked this

You're Reading a Free Preview

Download
scribd