In php.net the following is written:
Variable functions won't work with language constructs such as echo, print, unset(), isset(), empty(), include, require and the like. Utilize wrapper functions to make use of any of these constructs as variable functions.
source
What does that mean?
Could anyone give examples because I’ve tried using the variable function in an echo and it worked perfectly:
function city()
{
return "new york";
}
$var = "city";
echo "city: " . $var();
It means you can’t do something like this:
$var = "echo";
$var "Hello World!";
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With