开发者

call function in php, little help please

开发者 https://www.devze.com 2022-12-12 02:04 出处:网络
How can I call a function like below: $display_table=\"<table><tr><td>FUNCTION_CALL_HERE();</td></tr></table>\";

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";

?>
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号