Introduction to PHP

PHP stands for Hypertext Preprocessor. PHP is a server side, the general-purpose scripting language which originally designed for web development. The PHP code is embedded into HTML code to control the output of the web pages.

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

How PHP code looks like

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

The PHP code is embedded inside HTML document within the block  <?php ?>. In the above example, we print out the “Hello World” message to the web browser.

How PHP Works

The PHP  resides on the server and processes PHP script. The processing flow is as follows:

how php works

  • On the client side, a user sends an HTTP request to the web server by invoking a PHP web page through the web browser.
  • On the web server side, PHP executes the script, formats the output and sends the generated page, which is in plain HTML format, back to the web browser.
  • The web browser then renders HTML document to the user.

What PHP can do

PHP was originally designed for server-side scripting, therefore, you can use PHP for collecting data in a form, sending emails and generating web pages. With PHP, you can also develop sophisticated web applications such as intranet web applications, content management system (CMS) or even social networking sites.

Last but not least, you can use PHP for creating command-line programs.

  • Was this tutorial helpful ?
  • YesNo