PHP Tutorials - Herong's Tutorial Examples - Version 4.10, by Dr. Herong Yang

PHP Tutorials - Herong's Tutorial Examples

http://www.herongyang.com/PHP/

Copyright © 2015 by Dr. Herong Yang. All rights reserved.

HerongYang.com This free PHP tutorial book is a collection of notes and sample codes written by the author while he was learning PHP himself. It can be used as a tutorial guide for beginners or a reference book for experienced developers. Topics include PHP, array, CGI, CLI, class, cookie, database, directory, file, HTTP, header lines, Apache, image, mail, MySQL, object, redirect, request, response, session, SMTP, SOAP, SOAP Extension, SQL, Unicode, WSDL.

Table of Contents

About This PHP Tutorial Book

Introduction and Installation of PHP 5.6.6

What Is PHP?

Downloading and Installing PHP 5.6.6 for Windows

"php -help" - Command Line Options

"php -m" - Built-in Modules

"php -i" - PHP Engine Information

php.ini - PHP Runtime Configuration

Hello.php - My First PHP Script

Downloading and Installing PHP Documentation

PHP Script File Syntax

PHP Script Source Code File Format

PHP Script Processing Rules

PHP Statement Delimiter and Comments

PHP Data Types and Data Literals

Data Types Supported in PHP

Data Literals Supported in PHP

Data Literals Examples for Integer, String and Other Data Types

Overflow of Integer and Float Values

Variables, References, and Constants

Variables and Assignment Operations

References and Variables

Variable Variable Name - Name Variables with Expressions

Constant and define() Function

Expressions, Operations and Type Conversions

What Is an Expression?

What Is an Operation?

Precedence of Operations

Data Type Automatic Conversion

Conditional Statements - "if" and "switch"

"if" Statements

"if" Statement Examples

"switch" Statements

"switch" Statement Examples

Loop Statements - "while", "for", and "do ... while"

"while" Statements

"while" Statement Examples

"for" Statements

"for" Statement Examples

"do ... while" Statements

"break" and "continue" Statements

Function Declaration, Arguments, and Return Values

What Is a Function?

"function" Statements - Defining Functions

Function Call Operations

Passing Arguments to Functions

Example of Passing Arguments by Values

Using Pass-by-Value Arguments for References

Example of Passing Arguments by References

Variable-Length Argument Lists

Providing Default Values to Argument Variables

Returning Values from Functions

Returning References from Functions

Arrays - Ordered Maps

What Is an Array?

Creating Arrays - Examples

Array Related Built-in Functions

Configuring and Sending out Emails

Using Local Windows System as a Mail Server

Sending Out Emails from PHP Scripts

Retrieving Information from HTTP Requests

Predefined Variables Related to HTTP Requests

Operating System Information in $_SERVER

Web Server Information in $_SERVER

Information in $_GET and $_REQUEST

Registering $_REQUEST Keys as Global Variables

Creating and Managing Sessions in PHP Scripts

What Is a Session?

How Sessions Are Support in PHP?

SessionPage*.php - Session Test Script Pages

Running Session Test Script Pages

Managing Session IDs without Cookies

Where Is Session Data Stored?

Sending and Receiving Cookies in PHP Scripts

What Is a Cookie?

Sending and Receiving Cookies

Sending and Receiving Cookies - Example

ob_start() - Output Buffering Function

Persistent Cookies Saved on Hard Disk

Other Cookie Properties - Domain and Path

Controlling HTTP Response Header Lines in PHP Scripts

What Is an HTTP Response?

HTTP Response Header Lines

header() - Inserting a Raw Header Lines

HttpRequestGet.php - Viewing Header Lines

Response Header Lines of Static Files

HttpHeaderLines.php - Examples of Inserting Header Lines

Location: - Forcing the Browser to Redirect to Another URL

Content-Type: - Generating Non-HTML Response Body

Content-Disposition: - Sending Files for Downloading

MySQL Server Connection and Access Functions

Configuring PHP for MySQL Server Access

mysql_connect() and Other MySQL Functions

MySqlLoop.php - MySQL Functions Test

Functions to Manage Directories, Files and Images

opendir() and Directory Management Functions

file_exists() and File Testing Functions

FileExistsTest.php - File Testing Examples

fopen() and File Input/Output Functions

File_Input_Output_Test.php - File Input/Output Examples

readfile() and Special File Handling Functions

imagecreatetruecolor() and GD Imaging Library Functions

ShowPhoto.php - Simple Slid Show Script

SOAP Extension Function and Calling Web Services

PHP Implementations of SOAP

Turning on the Default SOAP Extension

Hello_There.php - First Example of SOAP

SoapClient - SOAP Client Class and Functions

Hello_There_Dump.php - Debugging SOAP Messages

What Is WSDL?

Using SOAP Extension in non-WSDL Mode

SOAP Server Functions and Examples

SoapServer - SOAP Server Class and Functions

HelloServer.php - First SOAP Server Application

HelloServer12.php - First SOAP 1.2 Server Application

HelloServerWsdl.php - SOAP 1.2 Server Application in WSDL Mode

Localization Overview of Web Applications

What Is Localization / Internationalization?

Localization of Web Based Applications

Character String Traveling Paths

Output ASCII Character Strings from PHP Scripts

Using Non-ASCII Characters in HTML Documents

Basic Rules of Using Non-ASCII Characters in HTML Documents

French Characters in HTML Documents - UTF-8 Encoding

French Characters in HTML Documents - ISO-8859-1 Encoding

Chinese Characters in HTML Documents - UTF-8 Encoding

Chinese Characters in HTML Documents - GB2312 Encoding

Characters of Multiple Languages in HTML Documents

Using Non-ASCII Characters as PHP Script String Literals

Basic Rules of Using Non-ASCII Characters in HTML Documents

French Characters in String Literals - UTF-8 Encoding

French Characters in HTML Documents - ISO-8859-1 Encoding

Chinese Characters in String Literals - UTF-8 Encoding

Chinese Characters in String Literals - GB2312 Encoding

Characters of Multiple Languages in String Literals

Receiving Non-ASCII Characters from Input Forms

Basic Rules of Receiving Non-ASCII Characters from Input Forms

Receiving Non-ASCII Characters with GET Method

Receiving Non-ASCII Characters with POST Method

Receiving Non ASCII Characters in UTF-8 Encoding

Decoding HTML Entities

"mbstring" Extension and Non-ASCII Encoding Management

"mbstring" - Multi-Byte String Extension

mb_convert_encoding() and Other mbstring Functions

Examples of Using "mbstring" Functions

Managing HTTP Input and Output Encoding

Managing Non-ASCII Character Strings with MySQL Servers

Storing Non-ASCII Characters in Database

Transmitting Non-ASCII Characters with Database

MySqlUnicode.php - MySQL Unicode UTF-8 Encoding Example

Introduction of Class and Object

What Is a Class?

What Is an Object?

What Is a Constructor?

What Is a Static Method?

What Is a Static Variable?

What Is a Superclass and a Subclass?

What Is an Abstract Class?

What Is an Abstract Method?

What Is an Interface?

What Is a Trait?

What Is an Overloaded Property?

What Is an Overloaded Method?

What Is Object Property Iteration?

What Is Object Cloning?

What Is Object Serialization?

What Is in an Object Variable?

Updating Variables Who Share an Object

Passing Objects as Function Arguments

Integrating PHP with Apache Web Server

Downloading Apache HTTP Server 2.4.12 for Windows

Installing Apache HTTP Server 2.4.12 on Windows

Publishing HTML Documents as Web Pages

Starting and Stopping Apache Server

Configuring Apache for PHP CGI Scripts

Publishing PHP Scripts as Web Pages

Configuring Apache PHP Load Module

Outdated Tutorials

Outdated: Downloading and Installing PHP 5.4.3 for Windows

Outdated: Downloading and Installing PHP 5.2.2 for Windows

Outdated: Adding PHP to IIS as CGI

Outdated: Downloading and Installing PHP 5.0.4 for Windows

Outdated: Get_Temperature.php - First Example of SOAP

Outdated: Get_Temperature_Dump.php - Dumping Debugging Information

References

PDF Printing Version

Keywords: PHP, Tutorial, Examples, Web

Table of Contents - Updated in 2015, by Dr. Herong Yang