RAPID LEARNING PHP
RAPID LEARNING PHP
About the Book
Info
PHP is Object Oriented Programming Language from building Server Side scripts .
PHP home page is at https://secure.php.net/.
Book content
This book is collection of standalone tutorials.
This means that each tutorial contains minimum amount of code needed to explain specific functionality.
This is in contrast to building a single application where each new functionality is added on top of already explained ones.
Each tutorial has minimum amount of supporting text making emphasis on the code example to do the explaining.
How to use this book
This book can be used as an introduction to PHP language covering all of the basic core functionalities.
In addition book will be updated with more tutorials covering more specific subjects.
Book is also intended as Just In Time Support so that user can learn what it needs when it needs it.
This is why tutorials are standalone and minimalistic focusing only at one problem at the time.
Table of Contents
1.1 About PHP
1.2 Install PHP on OS
1.2.1 Install PHP on Windows
1.3 Install PHP on Web Server
1.3.1 Install PHP on IIS
1.3.2 Install PHP on Apache
1.4 Create PHP Application
1.4.1 Create PHP Console Application
1.4.2 Create PHP Web Application
2. Basic Syntax
2.1 Comments
2.1.1 Single Line
2.1.2 Multi Line
2.2 Operators
2.2.1 Comparison
2.2.2 Arithmetic
2.2.3 Assignment
2.2.4 Bitwise
2.2.5 Logical
2.2.6 Cast
2.3 Statements
2.3.1 Conditional
2.3.1.1 Branching
2.3.1.1.1 if
2.3.1.1.2 else
2.3.1.1.3 elseif
2.3.1.1.4 Question ?:
2.3.1.1.5 switch
2.3.1.2 Looping
2.3.1.2.1 for
2.3.1.2.2 foreach
2.3.1.2.3 while
2.3.1.2.4 do...while
2.3.2 Jumping
2.3.2.1 goto
2.3.2.2 break
2.3.2.3 Continue
2.3.3 Assignment
2.3.3.1 Operators
2.3.3.2 list
2.3.4 Script Inclusion
2.3.4.1 include
2.3.4.2 require
2.3.4.3 require_once
2.4 Functions
2.4.1 Declare
2.4.1.1 Name
2.4.1.2 Return value
2.4.1.2.1 None
2.4.1.2.2 Single
2.4.1.2.3 Multiple
2.4.1.3 Parameters
2.4.1.3.1 Number of parameters
2.4.1.3.1.1 Zero
2.4.1.3.1.2 Fixed
2.4.1.3.1.3 Variable
2.4.1.3.2 Default values
2.4.1.3.3 Types
2.4.1.3.4 By Value
2.4.1.3.5 By Reference
2.4.2 Reference
2.5 Data types
2.5.1 Scalar
2.5.1.1 Null
2.5.1.2 Boolean
2.5.1.3 Integer
2.5.1.4 Float
2.5.2 Compound
2.5.2.1 Array
2.5.2.2 Class
2.5.2.3 String
2.5.3 Type casting
2.5.3.1 Explicit
2.5.3.2 Implicit
2.5.4 Type Related Functions
2.6 Literals
2.6.1 Null
2.6.2 Boolean
2.6.3 Integer
2.6.3.1 Decimal Notation
2.6.3.2 Binary Notation
2.6.3.3 Octal Notation
2.6.3.4 Hexadecimal Notation
2.6.4 Float
2.6.4.1 Basic Notation
2.6.4.2 Scientific Notation
2.6.5 Array
2.6.5.1 Indexed Notation
2.6.5.2 Associative Notation
2.6.5.3 Mixed Notation
2.6.6 String
2.6.6.1 Double Quotes Notation
2.6.6.1.1 Parsing Variables using Simple Syntax
2.6.6.1.2 Parsing Variables using Complex Syntax
2.6.6.2 Single Quotes Notation
2.6.6.3 Heredoc Notation
2.6.6.4 Nowdoc Notation
2.7 Variables
2.6.1 Declaration
2.6.1.1 Location
2.6.1.2 Name
2.6.1.3 Scope
2.6.1.3.1 Function
2.6.1.3.2 Global
2.6.1.4 Persistence
2.6.1.4.1 Static
2.6.1.4.2 Non Static
2.6.2 Assignment
2.6.2.1 Location
2.6.2.2 By Value
2.6.2.3 By Reference
2.7 Constants
2.8 Web Page Delimitators
3. Object Oriented Syntax
3.1 Classes
3.1.1 Declare
3.1.2 Reference
3.1.3 Abstract
3.1.4 Extend Class
3.1.5 Implement Interfaces
3.2 Interfaces
3.2.1 Declare
3.3 Methods
3.3.1 Declare
3.3.2 Reference
3.3.2.1 Through Class
3.3.2.2 Through Object
3.3.2.3 Using $this
3.3.2.4 Using self
3.3.3 Scope
3.3.3.1 Public
3.3.3.2 Protected
3.3.3.3 Private
3.3.4 Other Modifiers
3.3.4.1 Abstract
3.3.4.2 Static
3.3.4.3 Final
3.3.5 Predefined
3.3.5.1 __construct()
3.3.5.2 __destruct()
3.3.5.3 __set()
3.3.5.4 __get()
3.3.5.5 __clone()
3.4 Fields
3.4.1 Declare
3.4.2 Reference
3.4.3 Scope
3.4.3.1 Public
3.4.3.2 Protected
3.4.3.3 Private
3.4.4 Other Modifiers
3.4.4.1 Static
3.4.5 Simulate Properties
3.5 Objects
3.5.1 Create
3.5.2 Add Field
3.6 Exceptions
3.6.1 Throw
3.6.2 Catch
3.6.3 Create Custom
3.7 Helper Functions
3.7.1 _autoload()
4. Built in functionalities
4.1 PHP Directives
4.1.1 Basic operations
4.1.1.1 Find which php.ini is used
4.1.1.2 Set directives programmatically
4.1.2 List of Directives
4.1.2.1 Error Directives
4.1.2.2 Other directives
4.2 Data
4.2.1 Displaying
4.2.2 Sorting
4.2.3 Encrypting
4.3 Files
4.3.1 Text
4.3.1.1 Write
4.3.1.2 Append
4.3.1.3 Read
4.3.2 Binary
4.3.2.1 Write
4.3.2.2 Append
4.3.2.3 Read
4.3.3 Properties
4.3.3.1 Read
4.4 Regular Expressions
4.4.1 POSIX
4.4.2 PERL
4.5 Authentication
4.5.1 Based on Hard Coded Values
4.5.2 Based on File
4.5.3 Based on Database
4.6 Web Forms
4.6.1 HTTP Request parameters
4.6.1.1 Read from global array
4.6.1.2 Initialize Automatically
4.6.1.3 Multivalued form components
4.6.2 Refer to the same script
4.6.3 Server side validation
5. Tools
5.1 Composer
5.1.1 Install
5.1.2 Install Package
5.1.3 Commands
5.2 PEAR
5.2.1 Install
5.2.2 Test
5.2.3 Update
5.3 PHP Documentor
5.3.1 Install using PEAR
5.3.2 Create Documentation
5.3.3 Elements
5.3.3.1 Description
5.3.3.1.1 Short
5.3.3.1.2 Long
5.3.3.1.3 Formatting tags
5.3.3.2 Tags
5.4 PHPEclipse
5.4.1 Install using Online Update Site
5.4.2 Settings
5.4.2.1 PHP Interpreter
5.4.2.2 PHP External Tools
5.4.2.3 Indentation
5.4.2.4 Highlighting
5.4.3 Procedure
5.4.3.1 Create PHP Project
5.4.3.2 Create PHP File
5.4.3.3 Execute PHP File
6. Errors
6.1 Syntax
6.1.1 Content of PHP file is displayed instead of executed
6.1.2 Could not open input file: test.php
6.1.3 Failed opening required 'PEAR.php'
6.1.4 Failed opening required 'DB.php'
6.1.5 Failed opening required 'Log.php'
6.1.6 Failed to open stream
6.1.7 PHP Notice: Undefined index: LOGON_USER
6.1.8 FastCgiModule not available
6.1.9 PHP Notice: Undefined index: AUTH_USER
6.1.10 PHP Notice: Undefined index: REMOTE_USER
6.1.11 The program can't start because MSVCR110.dll is missing from your computer
6.1.12 The specified CGI application misbehaved
6.1.13 This PHP CGI binary was compiled with force-cgi-redirect enabled
6.1.14 Unable to load dynamic library 'C:\php\php_mysql.dll'
6.1.15 Unable to load dynamic library './ext\php_oci8.dll'
6.1.16 Warning: mysql_connect(): Access denied for user
6.2 PHP Documentor
6.2.1 Sorry, can't find the php.exe file.
6.3 Composer
6.3.1 The openssl extension is missing
6.4 PEAR
6.4.1 PHP_PEAR_PHP_BIN is not set correctly
6.4.2 'pear' is not recognized
6.4.3 **ERROR** Please, enter the php.exe path
7. Appendix
7.1 PHP Versions
7.2 PHP Cons
7.3 PHP Pros
7.4 Cheat Sheets
7.4.1 Boolean
7.4.2 Integer
7.4.3 Float
7.4.4 Array
7.4.5 String
7.4.6 Date
Other books by this author
The Leanpub 60 Day 100% Happiness Guarantee
Within 60 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.
Now, this is technically risky for us, since you'll have the book or course files either way. But we're so confident in our products and services, and in our authors and readers, that we're happy to offer a full money back guarantee for everything we sell.
You can only find out how good something is by trying it, and because of our 100% money back guarantee there's literally no risk to do so!
So, there's no reason not to click the Add to Cart button, is there?
See full terms...
Earn $8 on a $10 Purchase, and $16 on a $20 Purchase
We pay 80% royalties on purchases of $7.99 or more, and 80% royalties minus a 50 cent flat fee on purchases between $0.99 and $7.98. You earn $8 on a $10 sale, and $16 on a $20 sale. So, if we sell 5000 non-refunded copies of your book for $20, you'll earn $80,000.
(Yes, some authors have already earned much more than that on Leanpub.)
In fact, authors have earnedover $13 millionwriting, publishing and selling on Leanpub.
Learn more about writing on Leanpub
Free Updates. DRM Free.
If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).
Most Leanpub books are available in PDF (for computers) and EPUB (for phones, tablets and Kindle). The formats that a book includes are shown at the top right corner of this page.
Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.
Learn more about Leanpub's ebook formats and where to read them