php - How to echo an function -
i've been struggling echo output of function. tried this:
echo 'myfunction('foo')'; .. won't work, due single quotes. suggestions?
let's take function :
function getstr() { return "hello"; } it return string, means, calling :
echo getstr(); has same exact result calling :
echo "hello"; which means, result of function can treated variable (except cant modify it), can whatever want result :
$string = getstr() . ' - ' . getstr(); echo $string; // print "hello - hello";
Comments
Post a Comment