variable functions means that if a variable name has parentheses appended to it, PHP will look for a function with the same name as whatever the variable evaluates to, and will attempt to execute it.
function foo() {
echo "In foo()\n";
}
function bar($arg = '')
{
echo "In bar(); argument was '$arg'.\n";
}
function echoit($string)
{
echo $string;
}
$func = 'foo';
$func(); // This calls foo()
$func = 'bar';
$func('test'); // This calls bar()
$func = 'echoit';
$func('test'); // This calls echoit()
variable functions means
Sun, 06/22/2008 - 19:06 — adminvariable functions means that if a variable name has parentheses appended to it, PHP will look for a function with the same name as whatever the variable evaluates to, and will attempt to execute it.
function foo() {
echo "In foo()\n";
}
function bar($arg = '')
{
echo "In bar(); argument was '$arg'.\n";
}
function echoit($string)
{
echo $string;
}
$func = 'foo';
$func(); // This calls foo()
$func = 'bar';
$func('test'); // This calls bar()
$func = 'echoit';
$func('test'); // This calls echoit()
http://php.net