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

Popular posts from this blog

php - Calling a template part from a post -

Firefox SVG shape not printing when it has stroke -

How to mention the localhost in android -