Trending News
Home / Web Development / PHP / Overview of PHP with simple example

Overview of PHP with simple example

Hi all,
Today we discuss PHP based topic like What is PHP, Why PHP, Difference between scripting languages and other language, What is a scripting language?, PHP Market share and usage and simple example.PHP is a Hypertext pre-processor. It’s a most popular scripting language on the web. It is widely used in open source source general-purpose scripting language and server side scripting language.

What is a scripting language?

A script is interpreted at runtime and it’s a set of programming instructions. The purpose of the scripts is it’s usually to enhance the performance or perform routine tasks for an application. Scripts are usually embedded into other software environments. The client side scripts are interpreted by the client application and the server side scripts are interpreted on the server. PHP is a server side scripting language so we can say that, it’s interpreted on the server. The best example of a client side script is JavaScript that is interpreted on the client browser. Both Javascript and PHP can be embedded into HTML pages.

Difference between scripting languages and other languages

Programming language Scripting language
Has all the features needed to develop complete applications. Mostly used for routine tasks
Programmed languages are compiled into a more compact form that does not need to be interpreted by another application in the same way. The compiled result is stand-alone. Scripted languages are interpreted within another program . Eg: JavaScript is put within HTML and then interpreted by the browser.
The code has to be compiled before it can be executed The code is usually executed without compiling
Programming languages may have more traditional structures and more concerns to address. Scripted languages may tend to be easier to learn, and can take less code to get something done.
Does not need to be embedded into other languages Is usually embedded into other software environments.
Programming languages on compilation make binaries The scripting language does not create any binary files (executables) and no memory will be allocated.

What is PHP

PHP is a server side scripting language and it’s mainly used for web application.

  • Server side scripting language
  • Free/ Open Source
  • Hypertext Preprocessor
  • Web Applications Development

It is a general purpose server side scripting language that is used to develop:

  • Web applications
  • Dynamic websites
  • Static websites

The client computers accessing the PHP scripts require a web browser only. A PHP file contains PHP tags and ends with the extension “.php”. The diagram below shows how a PHP file looks like.

The flowchart diagram shown below illustrates the basic architecture of a PHP web application and how the server handles the requests.


Why PHP?

  1. PHP is open source and free.
  2. PHP is regular updated to keep abreast with the latest technology trends.
  3. Large community document
  4. PHP is cross platform
  5. Short learning curve compared to other languages such as JSP, ASP etc.
  6. Most web hosting servers support PHP by default unlike other languages such as ASP that need IIS. This makes PHP a cost effective choice.
  7. PHP has in built support for working hand in hand with MySQL; this doesn’t mean you can’t use PHP with other database management systems. You can still use PHP with
    • Oracle
    • Postgres
    • ODBC
    • MS SQL Server

PHP Market share and usage

There are over 20 million websites and web application on the internet developed using PHP scripting language. PHP is very simple easy to understand and very helps to develope web applications.


Benefits of PHP

  • PHP is an open source software
  • It’s a free software. Free to download and use.
  • The PHP script execute on server. Because it’s a server side scripting language.
  • It runs on various platform like windows,linux,mac etc.
  • Italso support wide range of database

PHP Files

The PHP file save with .php extension. Older PHP file extensions include

  • .phtml
  • .phps
  • .php3
  • .php5
  • .php4

PHP was designed to work with HTML, and as such, it can be embedded into the HTML code.

You can create PHP files without any html tags and that is called Pure PHP file. Using

First PHP Program

The program shown below is a basic PHP application that outputs the words “Welcome to PHP”


If anyone has doubts on this topic then please do let me know by leaving comments or send me an email.

Loading Facebook Comments ...
Social Media Auto Publish Powered By :