Memory Refresh


<?php $name = 'foo'; $name = 'bar'; echo $foo; // Displays 'bar' It is possible to create variables whose names do not follow the variables constraints. <?php $name = '123'; $$name = '456'; echo ${'123'}; // output 456 Variable variables are a very powerful tool, and should be used with extreme care. Their improper use can lead to some significant security issues. A technique similar to variable variables can also be used to hold function names inside a variable: <?php function myFunc() { echo 'myFunc!'; } $f = 'myFunc'; $f(); // output myFunc!