Here is Techtopia's well written online book, PHP Essentials. This comprehensive online PHP book will show and teach you all the aspects and topics of PHP that you need to know for developing compelling web pages and web sites. It will help both new PHP programmers get up-to-speed with PHP, and also those who need a refresher with any of the topics presented.
PHP Essentials
gives a high level overview of how PHP works and why it is so useful to
web developers. It then teaches each PHP topic in detail, from the
basics of the scripting language through to object oriented
programming, file and filesystem handling and MySQL and SQLite database
access. Also, it provides chapters that show how to work
with HTML based forms and maintain state using cookies and PHP
sessions. All PHP topics are accompanied by real world
examples that are intended to bring PHP theory to life.
Table of Contents of PHP Essentials:
- About PHP Essentials
- Intended Audience
- The History of PHP
- The Creation of PHP
- PHP 3 Hits the Big Time
- PHP 4 - Optimization, Scalabilty and More
- PHP 5 - Object Orientation, Error Handling and XML
- How Popular is PHP?
- An Overview of PHP
- What Exactly is PHP?
- How Does PHP Work?
- Why is PHP so Useful?
- Summary
- Creating a Simple PHP
Script
- The PHP Code Delimiters
- Testing the PHP Installation
- Emdedding PHP into an HTML File
- Embedding HTML into a PHP Script
- Summary
- Commenting PHP Code
- PHP Single Line Comments
- PHP Multi-line Comments
- Summary
- An Introduction to
PHP Variables
- Naming and Creating a Variable in PHP
- Assigning a Value to a PHP Variable
- Accessing PHP Variable Values
- Changing the Type of a PHP Variable
- Checking Whether a Variable is Set
- Understanding PHP
Variable Types
- The PHP Integer Variable Type
- The PHP Float Variable Type
- The PHP Boolean Variable Type
- The PHP String Variable
- Extracting and Writing String Fragments
- Creating PHP heredoc Strings
- PHP Constants
- Defining a PHP Constant
- Checking if a PHP Constant is Defined
- Using a Variable as a Constant Name
- Predefined PHP Constants
- PHP Script and Environment Related Constants
- PHP Mathematical Constants
- PHP Operators
- PHP Assignment Operators
- PHP Arithmetic Operators
- PHP Comparison Operators
- PHP Logical Operators
- PHP Increment and Decrement Operators
- PHP String Concatenation Operator
- Concatenation of Numbers and Strings in PHP
- PHP Execution Operator - Executing Server Side Commands
- PHP Flow Control and
Looping
- PHP Conditional Statements
- The PHP if Statement
- The PHP if ... else Statements
- PHP Looping Statements
- PHP for loops
- PHP while loops
- PHP do ... while loops
- PHP switch Statements
- Breaking a Loop
- Breaking Out of Nested Loops
- Skipping Statements in Current Loop Iteration
- PHP Functions
- What is a PHP Function?
- How to Write a PHP Function
- Returning a Value from a PHP Function
- Passing Parameters to a PHP Function
- Calling PHP Functions
- Passing Parameters By Reference
- Returning Values By Reference
- Functions and Variable Scope
- PHP Arrays
- How to Create a PHP Array
- Accessing Elements in a PHP Array
- Creating an Associative Array
- Accessing Elements of an Associative Array
- Accessing Elements in a Multidimensional PHP Array
- Using PHP Array Pointers
- Changing, Adding and Removing PHP Array Elements
- Looping through PHP Array Elements
- Replacing Sections of an Array
- Sorting a PHP Array
- Sorting Associative Arrays
- Getting Information About PHP Arrays & other Array Functions
- Summary
- Working with
Strings and Text in PHP
- Changing the Case of a PHP String
- Converting to and from ASCII Values
- Printing Formatted Strings in PHP
- PHP printf formatting specifiers
- Finding the Length of a PHP String
- Converting a String into a PHP Array
- Removing Leading and Trailing Whitespace from a PHP String
- Comparing Strings in PHP
- String Comparison Functions Return Value
- Accessing and Modifiying Characters in String
- Searching for Characters and Substrings in a PHP String
- Extracting and Replacing Substrings in PHP
- Replacing All Instances of a Word in a PHP String
- PHP, Filesystems and
File I/O
- Opening and Creating Files in PHP
- Closing Files in PHP
- Writing to a File using PHP
- Reading From a File using PHP
- Checking Whether a File Exists
- Moving, Copying and Deleting Files with PHP
- Accessing File Attributes
- PHP Output Buffering
- Working with
Directories in PHP
- Creating Directories in PHP
- Deleting a Directory
- Finding and Changing the Current Working Directory
- Listing Files in a Directory
- An Overview of HTML Forms
- Creating HTML Forms
- HTML Text Object
- HTML TextArea Object
- The HTML Button Object
- HTML Check Boxes
- HTML Radio Buttons
- HTML Drop-down / Select Object
- HTML Password Object
- Summary
- PHP and HTML Forms
- Creating the Form
- Processing Form Data Using PHP
- Processing Multiple Selections with PHP
- PHP
and Cookies - Creating, Reading and Writing
- The Difference Between Cookies and PHP Sessions
- The Structure of a Cookie
- Cookie Name / Value Pair
- Cookie Expiration Setting
- Cookie path Setting
- Cookie domain Setting
- Cookie Security Setting
- Creating a Cookie in PHP
- Reading a Cookie in PHP
- Deleting a Cookie
- Understanding PHP Sessions
- What is a PHP Session?
- Creating a PHP Session
- Creating and Reading PHP Session Variables
- Writing PHP Session Data to a File
- Reading a Saved PHP Session
- PHP Object Oriented
Programming
- What is an Object?
- What is a Class?
- How is an Object Created from a Class?
- What is sub-classing?
- Defining a PHP Class
- PHP Class Constructors and Destructors
- Creating Members in a PHP Class
- Defining and Calling Methods
- Subclassing in PHP
- PHP Object Serialization
- Getting Information about a PHP Object
- Using PHP with MySQL
- Creating a MySQL User Account
- Creating and Select MySQL Database
- Creating a MySQL Database Table
- Inserting Data into a MySQL Database Table
- Connecting with PHP to a MySQL Server
- Selecting Records from a MySQL Database Using PHP
- Adding Records to MySQL Database using PHP
- Modifying and Deleting MySQL Records using PHP
- Using PHP to get Information about a MySQL Database
- Summary
- PHP and SQLite
- Creating an SQLite Database with PHP
- Using PHP to Add Records to an SQLite Database
- Using PHP to Select Records from an SQLite Database