php anonymous function parameters -
i'm trying understand anonymous functions in php (laravel framework) , searched basic question here didn't find answer.
echo preg_replace_callback('~-([a-z])~', function ($match) { return strtoupper($match[1]); }, 'hello-world'); // outputs helloworld
what parameters gone inside anonymous function ??
route::match(['get', 'post'], '/', function () { return 'hello world'; });
http://php.net/preg_replace_callback
a callback called , passed array of matched elements in subject string. callback should return replacement string. callback signature:
so sends in array of matches.
Comments
Post a Comment