PHP - passing functions return to another function
10,686
Yes, you just need
return myFunction();
Author by
Wordpressor
Updated on June 04, 2022Comments
-
Wordpressor almost 2 years
I have a PHP function that returns something:
function myfunction() { $array = array('one', 'two', 'three', 'four'); foreach($array as $i) { echo $i; } }
And another function where I want to pass return values from the function above:
function myfunction2() { //how to send myfunction()'s output here? I mean: //echo 'onetwothreefour'; return 'something additional'; }
I guess it will look something like
myfunction2(myfunction)
but I don't know PHP too much and I couldn't make it work.