Searching...
Tuesday 11 September 2012

Php Naming Conventions Variables

9:26 pm

                  Php Naming Conventions Variables

Php Naming Conventions Variables :


1.       A variable value can have alpha numeric characters and underscore.
2.       A variable name should start with a letter and underscore.
3.       No space is allowed between the characters of a variable name.
4.       Variable names are case sensitive.
5.       It is advisable not to use the reserved keywords of php as a variable name.
Ex : $firstName
       $last_name
       $_age
6.       Dot operator (.) operator is the concatenation operator used in php.
<?php
$firstName = “india”;
$last_name= “tech”;
$_age = 25;
Echo $firstName.”—“.$last_name.”—“.$_age.”<br>”;
Echo “firstName--$last_name--$_age<br>”;
Echo ‘$firstName--$last_name--$_age<br>’;
?>
Note :  If we use a variable in double quotes(“ “) self expansion of the variable will happen where the memory usage is more.
So we should not use a variable in double quotes(“ “).


Php Naming Conventions Variables

0 comments:

Post a Comment