In PHP I can say
$noun = "bird";
$adjective = "warm;
echo <<<EOT
The $noun is very $adjective
EOT;
and it will output
The bird is very warm
Is there a way to do this with functions?
function getNoun() { return "bird"; }
function getAdjective() { return "warm"; }
echo <<<EOT
The getNoun() is very getAdjective()
EOT;
and output
The bird is very warm
You can use variable functions, though they're rather frowned on upon as they're not far different from variable variables...
$a = 'getNoun';
$b = 'getAdjective';
echo <<<EOT
The {$a()} is very {$b()}
EOT;
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