php 匿名函数 匿名函数
1. 匿名函数 匿名函数 2. 箭头函数 箭头函数(更简洁的匿名函数) 3. 匿名函数 有时,我们会在代码中编写匿名函数。 虽然性能不太有保证,但也还不错。
GGAMI
- 匿名函数 匿名函数
<?php
$multiply = function ($x, $y) {1. 匿名函数 匿名函数 2. 箭头函数 箭头函数(更简洁的匿名函数) 3. 匿名函数 有时,我们会在代码中编写匿名函数。 虽然性能不太有保证,但也还不错。
<?php
$multiply = function ($x, $y) {$myFunction = (arg1, arg2, ...argN) => {
statement(s)
}
or
$myFunction = (arg1, arg2, ...argN) => expression$input = 100;
$result = (function (int $input) {
return $input*5;
})($input);有时,我们会在代码中编写匿名函数。
虽然性能不太有保证,但也还不错。