What is PHP?

PHP is a language which supports server side scripting and mainly used to create Static websites, Dynamic websites and Web applications.

Its also called hypertext preprocessor as its libraries are already compiled. When you request for any PHP page in the address bar of the browser that request is first sent to the server then server interpret your files and return back response in form of HTML.

You can understand through below Image :

PHP and Server Communications

 

Its file usually has PHP tags and its extension is “.php“.

Syntax:-

<!DOCTYPE HTML>
<html>
<head>
<title>Example</title>
</head>
<body>
<?php echo "Hello World!"; ?>
</body>
</html>

Why use this Programming Language?

You have clearly head of variety of programming languages out there, you will be want to know why we would wish to use this as our poison for the web programming. Below are number of reasons to use this programming language.

  • It is open source and free.
  • Due to cross platform you can deploy your application on different operating systems such as (Windows, Linux, Unix, Mac OS X, etc.)
  • Its compatible with almost all servers like (Apache, IIS, etc.)
  • Easy learning compared to other languages such as JSP, ASP etc.
  • Most web hosting servers support this programming language by default. This makes it cost effective.
  • Regular updated to keep alongside with the latest technology trends.
  • Other benefit that you get with PHP is that it’s a server side scripting language, this means you only need to install it on the server and client computers requesting for resources from the server do not need to have PHP installed, only a web browser would be enough.
  • It has in built support for working with MySQL, this doesn’t mean you can’t use it with other database management systems. You can still use it with
    • Postgres
    • Oracle
    • MS SQL Server
    • ODBC etc.

PHP Versions:-

PHP Versions

Few PHP Important Points :

  • This is designed to work with HTML, it can be embedded with HTML code.
  • You can create pure PHP files without any HTML which can called PHP file.
  • The server interprets its code and on web browsers its results as HTML.
  • To identify the PHP code on server from HTML code, we must enclose its code in PHP tags.
  • Due to case sensitive, “VAR” and “var” is not same.
  • We will be consider code line as statements. Its statements always end with a semi colon (;). If you have only one statement then you can skip the semi colon. If more than one statement, then must end each line with a semi colon. Its scripts always executed on the server and output returned in form of HTML.