login

Introduction to PHP

PHP stands for Hypertext Preprocessor. PHP is a server side, general-purpose scripting language which originally designed for web development to create dynamic web pages and web-based applications. PHP code is embeded into HTML code to control the output of a web page dynamically.

PHP was created in 1995 by Rasmus Lerdorf and has been continuosly improved by adding a lot of added features in each version.  PHP is free and released under the PHP license.

How PHP code look like?

Let's take a look at a simple example of using PHP.

<html>
    <head>
        <title>Introduction to PHP</title>
    </head>
    <body>
        <?php
             echo "Introduction to PHP";
        ?>
    </body>
</html>

As you see the, PHP code is embeded within HTML document within the <?php and ?>. In the above example, we print out the "introduction to PHP" text in the web browser.

How PHP Works?

The PHP software sits in the server and process PHP scripts.  The processing flow is as follows:

  • User sends a HTTP Request to the web server by invoking PHP web page from address bar in web browser.
  • In the web server, PHP executes PHP scripts, format the output and sends result as plain HTML document back to the browser
  • Web browser displays HTML document to user.

How PHP Works

What PHP can do?

PHP was originally designed for server side scripting therefore you can use PHP for collecting data in a form, send and receive email and generate dynamic web pages. With PHP you can also develop a complicated web applications such as intranet web application, content management system (CMS) such as Joomla, Drupal , blogging tool such as Wordpress. You can also use PHP to create a e-commerce website such as shopping cart with ease of pain. Last but not least, PHP can be used for creating command line scripting and desktop application.