I tried to call foo() inside a string like this:
echo "This is a ${foo()} car";
function foo() {
return "blue";
}
but, it ends up with a syntax error.
I found here something similar, but not exactly what I need:
echo "This is the value of the var named by the return value of getName(): {${getName()}}";
Is that possible to do this ?
Is it possible? No.
It’s the first note for the curly syntax on http://www.php.net/manual/en/language.types.string.php#language.types.string.parsing.complex.