Month: November 2013

using PHP Values as Variable names and to call Functions

This should apply to perl as well:

Variable name:

$myvar = 'foo';
${$myvar} = 'haswell';
echo $foo

Call a function:

$type = 'red';
$myClass->$type(); == $myClass->red();

Taken from:

More helpful stuff:

${"variableName"} = 12;



Are there any other Languages that can do this, I know Perl Can…

And What is this ability called?

Please Leave a commment if you have more information.