abstract:<?php$demo1=function($name){ return $name.'最爱的人是:赵敏';};echo $demo1('张无忌'),'<hr>';$belle='周芷若';$demo2=function($name){ return '张无忌最爱的人是:'.$name;};echo $
<?php
$demo1=function($name){
return $name.'最爱的人是:赵敏';
};
echo $demo1('张无忌'),'<hr>';
$belle='周芷若';
$demo2=function($name){
return '张无忌最爱的人是:'.$name;
};
echo $demo2($belle),'<hr>';
$func1=function (){
$name='无忌哥哥';
$test=function() use ($name){
return $name.',我被另一个函数包住了,快来救我';
};
return $test();
};
echo $func1(),'<hr>';
$name='无忌哥哥';
$test=function() use ($name){
return $name.',我又被当做参数了,你还要我吗';
};
$func2=function (callable $test){
return $test();
};
echo $func2($test),'<hr>';
$func3=function (){
$name='无忌哥哥';
//在函数中声明一个匿名函数
$test=function() use ($name){
return $name.',我又被当做返回值了';
};
);
return $test;
};
echo $func3()(),'<hr>';
Correcting teacher:查无此人Correction time:2019-05-22 09:22:56
Teacher's summary:完成的不错。下面应该就学到类了,就会对php有更深的理解。继续加油