Is that possible to expand function call in PHP string?
php, string
Solution
Is it possible? No.
Functions, method calls, static class variables, and class constants inside {$} work since PHP 5. However, the value accessed will be interpreted as the name of a variable in the scope in which the string is defined. Using single curly braces ({}) will not work for accessing the return values of functions or methods or the values of class constants or static class variables.
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.
Problem
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 ?