Full width home advertisement

Post Page Advertisement [Top]

Variables are those words whose value varies and use to store constants like 5,6,"hello" etc..

In PHP variabes are declared by $(dollar sign).

Syntax: $variable_name

Variable may be anytype. There is no need to define variable for any data type, PHP auto define it when the first value passes to variable.


$x = 5; //Integer type variable

$m = "hello"; //string type variable

$x = 5;
$y = 8.5; // float type variable.
$z = $x + $y; //float type variable.
echo $z;
//Output: 13.5

Rules for defining variables:
* Variable start with alphabets.
* It can be alphanumeric with special symbol _ .

No comments:

Post a Comment

Bottom Ad [Post Page]

| Designed by Colorlib