Beginning with php code:
Create a file naming new1 in localhost and save it with .php format like new1.php ?,
In the address bar of browser type localhost/new1.php?.

PHP Variable is that one which value is changeable and where we can store value such as string or the integer. A variable can be used many times instead of using same value many time in your PHP code. To declaring a Variable we have to assign with $ means beginning character is $. Otherwise it will not work.Example is given below-  

After declaring this variable the value is stored in this variable. Any time it can be executed.
PHP is Loosely Type language. So, we needn't declare data type of variable in PHP. It automatically trace correct data type according to it's value.

Rules of Variable

There few rules when you want to write variable name..
1) You should declare a variable using $ like $total.
2) Variable must start with a letter or underscore "_". like $_POST['name'];
3) You can use alpha-numeric character and underscores.
4) Variable can be more than one word at that time word should be separated by underscore. like $stu_info.

Yes, Variable name is case sensitive, so can't use same name as variable. like $name, we can not use next time same variable as $Name. If we use at that time it will be another variable.

According above discussion we have given perfect example of PHP Variable below-

  $hello='Hello Worlds!';
  $student_name="Md.Imrul Kaise";

All Tutorial => 12345678910

Write Comment