How can I call a function like below:
$display_table="<table><tr><td>FUNCTION_CALL_HERE();</td></tr></table>";
I have tried brackets and all, but the function wont get called...
How should 开发者_如何学PythonI make this work? (syntax problems I think)
Thanks
is there a reason you cannot use string concatenation? Assuming the output of FUNCTION_CALL_HERE
is a string.
$display_table="<table><tr><td>" . FUNCTION_CALL_HERE() . "</td></tr></table>";
$display_table="<table><tr><td>" . FUNCTION_CALL_HERE() . "</td></tr></table>";
Alternatively:
$display_table="<table><tr><td>{FUNCTION_CALL_HERE()}</td></tr></table>";
Actually should be:
<?php
function asdf() {
return 'this is my string';
}
$f= 'asdf';
echo "Hello {$f()}\n";
?>
精彩评论