You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// Case 1:$fn = function($e) { // Undefined is not a function on line NaNecho$e;
}
$fn("hello\n");
// Case 2:functioncallme($str, $func) {
$func($str);
}
callme( "maybe", function($e) { // Undefined is not a function on line NaNecho$e . "\n";
} );
// Case 3:echopreg_replace_callback('~-([a-z])~', function ($match) { // Undefined is not a function on line NaNreturnstrtoupper($match[1]);
}, 'hello-world');
Output:
hello
maybe
hello-world
The text was updated successfully, but these errors were encountered:
Closures and Anonymous Functions Affect a Syntax Error
Any attempt to create a callback function, anonymous function, or wrapper, generates a syntax error.
http://php.net/manual/en/functions.anonymous.php
Anonymous Function Syntax Errors
Output:
hello
maybe
hello-world
The text was updated successfully, but these errors were encountered: