Introduction to PHP | What is PHP


PHP is a widely-used open source general-purpose scripting language. It is an HTML-embedded, server-side scripting language primarily used to develop static and dynamic websites and web applications. PHP is very powerful and scalable language yet easy to learn and use.

The PHP stands for "PHP : Hypertext Preprocessor", where the first PHP meas Personal Home Page. PHP is an interpreted language, means theres no need for any compilation, we just only need to install php application on the server. PHP code are executed on the server, and the result is returned to the browser as plain HTML. PHP files can contain text, HTML, CSS, JavaScript, and PHP code. It has ".php" file extension. The server interprets the PHP code and outputs the results as HTML code to the web browsers. PHP support Object Oriented Programming.

Some of the Characteristics of PHP is as follows :

Performance : Script written in PHP executes much faster then those scripts written in other languages such as JSP & ASP.

Open Source Software : PHP source code is free available on the web, you can developed all the version of PHP according to your requirement without paying any cost.

Portability : PHP runs on various platforms such as Microsoft Windows, Linux, Mac OS, etc. and it is compatible with almost all servers used today such Apache, IIS, etc.

Easy to learn : PHP is easy to learn and use. For beginner programmers who just started out in web development, PHP is often considered as the best and preferable choice of scripting language to learn.

Vast Community : Since PHP is supported by the worldwide community, finding help or documentation for PHP online is extremely easy.

With PHP We can do following Things :

  • With PHP we can create static and Dynamic websites or web applications.
  • With PHP we can create, open, read, write, delete, and close files on the server.
  • With PHP we can handle form data.
  • With PHP we can set cookies and access cookies variables. 
  • WIth PHP WE can send emails to the users of the website.
  • PHP can be integrated with the number of popular databases, including MySQL, PostgreSQL, Oracle, Sybase, Informix, and Microsoft SQL Server.
  • With PHP we can store, delete, and modify information in the database.
  • With PHP we can encrypt data for safe transmission over internet.

PHP example code :

The syntax of PHP are similar to C-like syntax and in php the variable names are case-sensitive but function names are not case sensitive. Now lets see a simple php example, which prints the "hello world" text on the screen :
<?php
  echo "Hello world";
?>