TypePHP 编译器 https://swoole.com/aot/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

38 lines
518 B

--TEST--
static closure use by reference through internal callback
--FILE--
<?php
function main(): void
{
$seen = [];
$values = [1, 2, 3];
$result = array_map(
static function (int $value) use (&$seen): int {
$seen[] = $value;
return $value * 10;
},
$values
);
var_dump($result);
var_dump($seen);
}
?>
--EXPECT--
array(3) {
[0]=>
int(10)
[1]=>
int(20)
[2]=>
int(30)
}
array(3) {
[0]=>
int(1)
[1]=>
int(2)
[2]=>
int(3)
}