Basics of PHP

on Saturday, November 3, 2012

PHP Basics

Before starting PHP you should know about HTML ,scripting and the basics of PHP.
Example of PHP application is www.facebook.com .

Now coming to topic,

The first question arises in your mind what is PHP and PHP stands for What?
The answer is PHP HYPERTEXT PREPROCESSOR .

PHP is server side scripting language i.e. you need a server to run the PHP code.

Now the questions comes to extension of PHP,
The extension of PHP are .phtml , .php , .php3.
You can use any of above three for PHP.

When you are concerning with web application then you should aware with the presentation of web pages that uses HTML for the presentation.
In next section we will learn loops uses in PHP.


PHP Syntax

As we know PHP is a scripting language and all the scripting language start with a tag.
PHP start with a tag   <?php          .....code........     ?>
(Note: don’t gap between <? And php it will be error)
The following example clears all the queries about syntax:-
i)                   In PHP format-

<?php
echo “Hi this is my first PHP code”;
//”echo” is user for print
// you can also use “print”
?>
              //save file as “a.php”.
ii)                 In HTML context

<html>
<head></head>
<body>
<?php
Echo “welcome in PHP </br>”;
echo “This is my first PHP code”;
?>
</body>
</html>

//save as  “name.php”.