How to Declare Variables in PHP - PHP Variables Creation


How to Declare Variables in PHP - PHP Variables Creation

As like all other languages the purpose of variables in PHP is same. As like C, C++, C#, Java and VB the variables are used to store the values.

But as like C, C++, C#, Java and VB the PHP variables are not strictly typed, In PHP the variables are loosely typed and and no need to specify the Data Types of any variable at the time of declaration. The PHP variables implicitly convert to its assigning values.

The PHP variables should start with $ sign whenever they used.

For Example:-

<?php
$str;
$x=10;
$str="Hello PHP Variables";
$y=10.5;
echo $str;
echo $x;
echo $y;
?>




{ 0 comments... read them below or add one }

Post a Comment