Mar*_*tin 2 php closures function callback
我正在学习闭包,但我坚持这个:
function addPrefix($string) {
return function($prefix) use ($string) {
echo $prefix.$string;
};
}
$randomstring = "a test";
$c = addPrefix($randomstring);
echo $c("This is ");
Run Code Online (Sandbox Code Playgroud)
为什么$前缀连接在一起?它甚至不被称为争论,我只是不明白.