Variables are used to store data such as the string of text, numbers etc. Variable values can change during a script. Some important things to know about variables are:
In PHP, a variable does not should be announced before enhancing it. PHP consequently changes over the variable to the right information write, contingent upon its esteem.
In the wake of pronouncing a variable it can be reused all through the code.
The task administrator (=) used to allot an incentive to a variable.
Syntax -
$var_name = value;
Exmaple -
<?php
// Declaring variables
$txt = "Hello World!";
$number = 10;
// Displaying variables value
echo $txt; // Output: Hello World!
echo $number; // Output: 10
?>
In the above case we have made two factors where initial one has allocated with a string esteem and the second has doled out with a number. Later we've shown the factors esteems in the program utilizing the resound explanation. The PHP resound explanation is regularly used to yield information to the program. We will take in more about this in up and coming part.
0 comments:
Post a Comment