Although you can use variables within strings in PHP, you can’t do functions. Well, not quite. If your function name begins with a dollar sign ($), it works fine. You can exploit this to call non-object functions such as htmlspecialchars.
$F = "F";
function F($s) { return $s; }
$filename = '';
echo "{$F(htmlspecialchars($filename))}";
function F($s) { return $s; }
$filename = '';
echo "{$F(htmlspecialchars($filename))}";
It’s still not as clean as if you had separated application logic and presentation code like you should have. I really don’t recommend doing this, but it’s an interesting approach.
I'm on Twitter!
I always thought you could do this anyway.. O_o
Nah.
“{htmlspecialchars($var)}” won't work.
Oh I see. Well, awesome. :)