Table of Contents


You should have a basic working knowledge of the following:

  • HTML5
  • CSS

Knowledge of JavaScript is recommended but not mandatory.

What is PHP?

  • PHP is an acronym for “PHP: Hypertext Preprocessor”.
  • PHP is a widely-used, open source scripting language.
  • Used for backend web development.
  • PHP scripts are executed on the server.
  • Can be embedded into HTML documents.

What is a PHP file?

  • PHP files can contain text, HTML, CSS, JavaScript, and PHP code.
  • PHP code is executed on the server, and the result is returned to the browser as plain HTML.
  • PHP files have extension “.php”.

What is a PHP Script?

  • A PHP script can be placed anywhere in the document.
  • A PHP script starts with <?php and ends with ?>:
2    echo "Hello world";
Hello world
  • PHP statements end with a semicolon (;).
  • An example of a complete PHP document:
 1<!DOCTYPE html>
 3    <head>
 4        <title>Example</title>
 5    </head>
 6    <body>
 8        <?php
 9            echo "Hi, I'm a PHP script!";
10        ?>
12    </body>
Hi, I'm a PHP script!


What Can PHP Do?

  • Generating dynamic page content that can be easily updated.
  • Creating, opening, reading, writing, and terminating files on the server.
  • Ability to collect form data.
  • Sending and receiving cookies.
  • Used for controlling user access.
  • Encrypting sensitive user data.

Why is PHP So Widely Used?

  • Easy to learn and use: One of the main reasons PHP became so commonplace is that it is relatively simple to get started with. Even without extensive knowledge or experience in web development, most people could create a web page with a single PHP file in a relatively short period of time. The syntax is simple and command functions are easy to learn.
  • Open source: This also helps developers get started with PHP - it can be installed quickly and at zero cost. There is also open access to a wide range of PHP frameworks, such as Laravel and Symfony. This feature is also appealing to companies as it helps control the costs of web development.
  • Versatile: One of the major benefits of PHP is that it is platform independent, meaning it can be used on Mac OS, Windows, Linux and supports most web browsers. It also supports all the major web servers, making it easy to deploy on different systems and platforms at minimal additional cost.
  • Enjoys strong community support: As a veteran scripting language that is widely used, PHP now has a large and loyal community base to support it. There are tons of tutorials, FAQs, and tips to help new PHP developers.
  • Fast and secure: Two things that every organization wants their website or application to be are fast and secure. PHP uses its own memory and competes well on speed, especially when using the newer versions. One important benefit is that because of its widespread use and community support there are now many tools, frameworks and best practices to help fix vulnerabilities and protect against cyberattacks.
  • Well connected with databases: PHP makes it easy to connect securely with almost any kind of database. This gives developers more freedom when choosing which database is best suited for the application being built.
  • Tried and tested: Being around for a quarter century, PHP code has been put to the test in all kinds of real-life environments. The main bugs have been found and fixed with regular updates, making the language more stable and trusted by developers. Moreover, many frameworks and tools have been built over time, helping to make PHP web development more secure, efficient and effective.
  • Lots of legacy code: Many existing websites have been written with PHP:
    • Facebook
    • Wikipedia
    • Tumblr
    • Slack
    • MailChimp
    • Etsy
    • WordPress