Minimum price
Suggested price


About the Book


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.

About the Author

Ivor Online
Ivor Online


"Things are only as complicated as they are badly explained" 

Proper documentation is essential to avoid struggle and frustration when working with simple things that only seem complicated by not being properly documented and explained. 



"Working example is worth thousand words"

Just like the picture is worth thousand words the same goes for the working example. Documentation in the form of working examples is proved to be the fastest and the most effective way of transferring knowledge. Sometimes an example is all you need to get the things done. And if there are some accompanying comments that explain what is going on even better. This approach is used in this book. This results in fast learning and the ability to apply tutorials when you need them in the spirit of Just In Time Support. 

I wish you rapid learning!




Table of Contents

1. Introduction


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.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         Branching        if        else        elseif        Question ?:        switch         Looping        for        foreach        while        do...while

2.3.2        Jumping         goto         break         Continue

2.3.3        Assignment         Operators         list

2.3.4        Script Inclusion         include         require         require_once

2.4      Functions

2.4.1        Declare         Name         Return value        None        Single        Multiple         Parameters         Number of parameters          Zero          Fixed          Variable      Default values         Types         By Value         By Reference

2.4.2        Reference

2.5      Data types

2.5.1        Scalar         Null         Boolean         Integer         Float

2.5.2        Compound         Array         Class         String

2.5.3        Type casting         Explicit         Implicit

2.5.4        Type Related Functions

2.6      Literals

2.6.1        Null

2.6.2        Boolean

2.6.3        Integer         Decimal Notation         Binary Notation         Octal Notation         Hexadecimal Notation

2.6.4        Float         Basic Notation         Scientific Notation

2.6.5        Array         Indexed Notation         Associative Notation         Mixed Notation

2.6.6        String         Double Quotes Notation         Parsing Variables using Simple Syntax         Parsing Variables using Complex Syntax         Single Quotes Notation         Heredoc  Notation         Nowdoc Notation

2.7      Variables

2.6.1        Declaration         Location         Name         Scope         Function         Global         Persistence         Static         Non Static

2.6.2        Assignment         Location         By Value         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         Through Class         Through Object         Using $this         Using self

3.3.3        Scope         Public         Protected         Private

3.3.4        Other Modifiers         Abstract         Static         Final

3.3.5        Predefined         __construct()         __destruct()         __set()         __get()         __clone()

3.4      Fields

3.4.1        Declare

3.4.2        Reference

3.4.3        Scope         Public         Protected         Private

3.4.4        Other Modifiers         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         Find which php.ini is used         Set directives programmatically

4.1.2        List of Directives         Error Directives         Other directives

4.2      Data

4.2.1        Displaying

4.2.2        Sorting

4.2.3        Encrypting

4.3      Files

4.3.1        Text         Write         Append         Read

4.3.2        Binary         Write         Append         Read

4.3.3        Properties         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         Read from global array         Initialize Automatically         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         Description         Short         Long         Formatting tags         Tags

5.4      PHPEclipse

5.4.1        Install using Online Update Site

5.4.2        Settings         PHP Interpreter         PHP External Tools         Indentation         Highlighting

5.4.3        Procedure         Create PHP Project         Create PHP File         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

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...

80% Royalties. Earn $16 on a $20 book.

We pay 80% royalties. That's not a typo: you earn $16 on a $20 sale. If we sell 5000 non-refunded copies of your book or course 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

Write and Publish on Leanpub

You can use Leanpub to easily write, publish and sell in-progress and completed ebooks and online courses!

Leanpub is a powerful platform for serious authors, combining a simple, elegant writing and publishing workflow with a store focused on selling in-progress ebooks.

Leanpub is a magical typewriter for authors: just write in plain text, and to publish your ebook, just click a button. (Or, if you are producing your ebook your own way, you can even upload your own PDF and/or EPUB files and then publish with one click!) It really is that easy.

Learn more about writing on Leanpub