Introduction to PHP – The Language of Choice for WEB

php-introductionThis tutorial covers the basic introduction to PHP. After going through this tutorial, you will be able to know what is PHP, why is it used and what do you need to start coding in PHP. A basic code of PHP has been shown at the end of the tutorial to familiarize you with the coding style of this language

What is PHP?

PHP is a hypertext prepocesser server side language which is executed on the server. It is a dynamic language allowing the programmer to generate dynamic program rather than a static program like in HTML. PHP is similar to PERL, C and Java. It supports a large number of databases. It is an open source software, free to download and easy to program.

Originally, PHP was created to develop dynamic web pages. It can be deployed on almost all of the web servers and it can also stand alone on the operating system. It was developed by Rasmus Lerdorf in the mid 90s. The acronym PHP originally stood for Personal homepage, however now the definition has been changed and PHP stands for Hypertext Preprocesser. Basically PHP is meant for server side scripting, however it can be used for other purposes as well, such as command line scripting or desktop applications etc.

Pre-requisite to learn PHP:

  • HTML : PHP is an HTML-embedded scripting language

Why Should I use PHP?

  • It has the support for multiple platforms
  • It contains the compatibility for most of the servers being used nowadays
  • It is free to download and easy to code
  • It runs smoothly over the server
  • It hides the technicalities from the viewers
  • It can be used to create server-side scripts, command line scripts and desktop applications
  • It reduced the time to create large scale websites due to its extensive functionality

Getting Started:

  • Install any compatible server on your PC such as Apache or IIS. As a shortcut you can download XAMPP from here. It will cover both PHP and mySQL as a database.
  • Look for a webhosting that supports PHP and your chosen database.

Some of the PHP web hosting plans:

  • Tripod
  • Spaceports
  • T35 Hosting

AS a matter of fact almost all webhosts these days support PHP. It is a language of choice for web development.

A Basic PHP Script:

The PHP code is always enclosed between the following instructions <?php and ?>. The “<?php” indicates the start of the php mode and the “?>” indicates the end of the php mode.

<html>

<head>

<title>My first basic PHP Script</title>

</head>

<body>

<?php echo “Hello World” ?>

</body>

</html>

 

Output:

Hello World

Leave a Reply