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