Log In
Or create an account ->
Imperial Library
Home
About
News
Upload
Forum
Help
Login/SignUp
Index
Title Page
Copyright Page
Dedication
Contents at a Glance
Contents
Acknowledgments
Introduction
Part I PHP Basics
Lesson 1 Introduction to PHP
A Little History
Info for Programmers
Why Is PHP so Popular?
Downloading and Installing Web Browsers
Choosing a Program Editor
Installing a PHP Server
Summary
Self-Test Questions
Lesson 2 Incorporating PHP into a Web Page
Where to Place the PHP Code
In the Document Head
In the Document Body
Including PHP Files
Using Comments
Using Semicolons
Summary
Self-Test Questions
Lesson 3 Learning PHP Language Syntax
Case Sensitivity
Whitespace
Variables
Variable Naming
String Variables
Using Quotation Marks in Strings
Using Heredoc Strings
Escaping Characters
Embedding Variables within a String
Variable Typing and Casting
Summary
Self-Test Questions
Lesson 4 Using Constants and Superglobals
Using Constants
Predefined Constants
The echo and print Commands
Superglobal Variables
Superglobals and Security
Other PHP Variables
Summary
Self-Test Questions
Lesson 5 Working with Arithmetic Operators
Arithmetic Operators
Modulus
Exponentiation
Incrementing and Decrementing Variables
Pre-Incrementing
Post-Incrementing
Pre- and Post-Decrementing
Arithmetic Functions
Assignment Operators
Summary
Self-Test Questions
Lesson 6 Applying Comparison and Logical Operators
Comparison Operators
Logical Operators
Exclusive Or
Boolean Negation
The Ternary Operator
Bitwise Operators
Operator Precedence
Operator Associativity
Summary
Self-Test Questions
Lesson 7 Creating Arrays
Array Names
Creating an Array
Assigning Values to an Array Element
Using Indexes
Retrieving Values
Using Array Elements as Indexes
Other Ways of Creating Arrays
Using Associative Arrays
Keys, Values, and Hash Tables
Other Ways of Creating an Associative Array
Summary
Self-Test Questions
Lesson 8 Managing Multidimensional Arrays
Creating a Two-Dimensional Array
Accessing a Two-Dimensional Array
A More Practical Example
Multidimensional Associative Arrays
Creating the Multidimensional Array
Accessing the Arrays
Summary
Self-Test Questions
Lesson 9 Calling Array Functions
Using foreach()
Using array_merge()
Using implode()
The array_walk() Function
Using array_push()
Using array_pop()
Using array_push() and array_pop() Together
Using array_reverse()
The array_flip() Function
Summary
Self-Test Questions
Lesson 10 Advanced Array Manipulation
Using FILO and FIFO Arrays
Buffering Using an Array
Using array_unshift() and array_shift()
Using sort()
Reversing a Sort
Using array_splice()
Removing Elements from an Array
Inserting Elements into an Array
Advanced Array Splicing
Summary
Self-Test Questions
Lesson 11 Controlling Program Flow
The if() Construct
Omitting the Braces
Positioning of Braces
The else Statement
The elseif() Construct
The switch() Statement
Using the break Keyword
Using the default Keyword
Allowing Fall-Through
Summary
Self-Test Questions
Lesson 12 Looping Sections of Code
Using while() Loops
The Example in Detail
Using do … while() Loops
The Example in Detail
Using for() Loops
The Example in Detail
Breaking Out of a Loop
Breaking Out of Multiple Loops
The continue Statement
Continuing within Multiple Loops
Summary
Self-Test Questions
Part II Advanced PHP
Lesson 13 Writing Functions
Using Functions
The return Statement
Passing Arguments
Accessing Arguments
Handling Unknown Numbers of Arguments
Global and Local Variable Scope
Using Local Variables
The $GLOBALS[] Superglobal Array
Global Naming Convention
Summary
Self-Test Questions
Lesson 14 Manipulating Objects
OOP Terminology
Declaring a Class
Creating an Object
Accessing Properties and Objects
Using a Constructor
Destructors
Object Cloning
Static Methods and Properties
Predefined Properties
OOP Constants
Property and Method Scope
Applying Inheritance
Using the parent Keyword
Writing Subclass Constructors
Using the final Keyword
Summary
Self-Test Questions
Lesson 15 Handling Errors and Expressions
Error Trapping
Regular Expressions
Using preg_match()
Using preg_match_all()
Using preg_replace()
Fuzzy Matching
Matching Any Character
Not Matching a Character
Summary
Self-Test Questions
Lesson 16 Building Web Forms
Creating a Form
The Difference Between Post and Get Requests
Security Issues with Get Requests
Accessing Form Data from PHP
About register_globals
Redisplaying a Form
The checkbox and select multiple Input Types
Using Hidden Fields
Summary
Self-Test Questions
Lesson 17 Maintaining Security
Sanitizing Input
Uploading Files to a Server
The $_FILES[] Array
File Security
Other Potential Insecurities
Summary
Self-Test Questions
Lesson 18 Accessing Cookies and Files
Using Cookies
Setting a Cookie
Reading a Cookie
Deleting a Cookie
Combining These Three Functions
Browser Identification
The GetBrowser() Function
File Handling
Testing for a File Existing
Creating or Opening a File
Writing to a File
Closing a File
Reading from a File
Summary
Self-Test Questions
Lesson 19 Advanced File Handling
Combining File Functions
Saving Any Form Data
Reading from the Data File
Prepopulating the Shopping List
The HTML Section
Even Simpler File Accessing
File Copying
File Deleting
File Moving
Random Access
Writing to a Random Access File
Managing Directories
File Locking
A Practical Example
Summary
Self-Test Questions
Lesson 20 Authentication, Sessions, and Ajax
Authentication
Using Sessions
Retrieving Session Variables
Combining Authentication with Sessions
Picking Up Session Details
Closing a Session
Session Security
Using Ajax
Creating an Ajax Object
The PostAjaxRequest() Function
The GetAjaxRequest() Function
The callback() Function
The ajax.php Program
Summary
Self-Test Questions
Appendix Answers to the Self-Test Questions
Lesson 1 Answers
Lesson 2 Answers
Lesson 3 Answers
Lesson 4 Answers
Lesson 5 Answers
Lesson 6 Answers
Lesson 7 Answers
Lesson 8 Answers
Lesson 9 Answers
Lesson 10 Answers
Lesson 11 Answers
Lesson 12 Answers
Lesson 13 Answers
Lesson 14 Answers
Lesson 15 Answers
Lesson 16 Answers
Lesson 17 Answers
Lesson 18 Answers
Lesson 19 Answers
Lesson 20 Answers
Index
← Prev
Back
Next →
← Prev
Back
Next →