相关疑难解决方法(0)

PHP - 传递函数返回另一个函数

我有一个PHP函数返回一些东西:

function myfunction() {
   $array = array('one', 'two', 'three', 'four');

   foreach($array as $i) {
     echo $i;
   }
}
Run Code Online (Sandbox Code Playgroud)

另一个函数,我想从上面的函数传递返回值:

function myfunction2() {
   //how to send myfunction()'s output here? I mean:
   //echo 'onetwothreefour';
   return 'something additional';
}
Run Code Online (Sandbox Code Playgroud)

我想它会看起来像,myfunction2(myfunction)但我不太了解PHP,我无法使它工作.

php return function

2
推荐指数
1
解决办法
8675
查看次数

标签 统计

function ×1

php ×1

return ×1