PHP tutorials


PHP is a server side general purpose scripting language, most widely used for developing web applications. It supports various databases namely MySQL, FbSQL, GeoIP, YAZ databases and so on.

Rasmus Lerdorf, a Greenlandic-Danish programmer created PHP in the year 1994. It is easy to learn. No prior programming language experience is required.

PHP file terminates with an extension .php .

Lets begin learning with an example,

<!DOCTYPE HTML>
<html>
    <body>
        <?php
            echo "Hello world, PHP script goes here!!";
        ?>
    </body>
</html>


Place the above piece of code in a file with an extension .php. When it gets executed, the text inside double quotes gets displayed on the terminal. In this example, PHP code begins with <?PHP and ends with ?>

PHP comments

PHP supports both single line and multi line comments that can be embedded in a .php webpage. Single line comments begin with double forward slash or single hash and multi-line comments can be embedded within special characters as shown below. Usage of comments is similar to C, C++, PERL and so on which makes easy to remember. 

<?php
    echo 'This is a test'; // This is a single-line c++ style comment

    echo 'One Final Test'; # This is a one-line unix shell-style comment
    /* This is a multi line comment
       yet another line of comment */  
?>