- php:
a. 代码:
<?php
function test(func){
func();
}
test(function(){
echo "string";
});
b. 输出:
Parse error: syntax error, unexpected ')', expecting variable (T_VARIABLE) in E:\test\web\test.php on line 2
- javascript:
a. 代码:
function test(func){
func()
}
test(function(){
console.log(1)
})
b. 输出:
1
|