Reputation:
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 I make this work? (syntax problems I think)
Thanks
Upvotes: 0
Views: 85
Reputation: 38318
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";
?>
Upvotes: 0
Reputation: 20073
$display_table="<table><tr><td>" . FUNCTION_CALL_HERE() . "</td></tr></table>";
Upvotes: 0
Reputation: 5317
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>";
Upvotes: 2