mirror of
https://github.com/adambard/learnxinyminutes-docs.git
synced 2025-01-29 11:20:21 +01:00
Clarify anonymous functions as callbacks as arguments
This commit is contained in:
parent
be46dc081a
commit
e051d0ec65
@ -330,7 +330,11 @@ $function_name(); // will execute the my_function_name() function
|
||||
Similar to variable functions, functions may be anonymous.
|
||||
|
||||
```php
|
||||
my_function(function () {
|
||||
function my_function($callback) {
|
||||
$callback('My argument');
|
||||
}
|
||||
|
||||
my_function(function ($my_argument) {
|
||||
// do something
|
||||
});
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user