Using PHP 5 I would like to know if a variable can dynamically refer to the value of several variables?
for example
<?php
$var = "hello";
$var2 = " earth";
$var3 = $var.$var2 ;
echo $var3;
Now, if I changed either $var, or $var2, I would like it to be $var3updated as well.
$var2 =" world";
echo $var3;
It still prints the evil earth, but I would like to print "hello world" now :(
Is there any way to achieve this?
source
share