an example
$fruit is a variable when 'banana' is a string value for that variable. when we do echo $fruit, the result is 'banana'.
$fruit = 'banana';
an example
This is a static variable. How about when I want to create new variable in a run time?. You can do it by adding double dollar sign
$fruit = 'banana';
echo $fruit;
//result : banana
an example
$fruit = 'banana';
$$fruit = 'durian';
echo $banana;
//result : durian
You can download sample file : How to use variable variables in php
more information
0 comments:
Post a Comment