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

Popular posts from this blog

python - pip install -U PySide error -

arrays - C++ error: a brace-enclosed initializer is not allowed here before ‘{’ token -

cytoscape.js - How to add nodes to Dagre layout with Cytoscape -