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.
 
 

42 lines
553 B

--TEST--
multiple static variables initialize independently once
--FILE--
<?php
function init_static(string $name, int $value): int
{
echo "init:$name:$value\n";
return $value;
}
function next_pair(int $seed): void
{
static $a = init_static('a', 10), $b = init_static('b', 20);
$a += $seed;
$b += $seed * 2;
var_dump([$a, $b]);
}
function main(): void
{
next_pair(1);
next_pair(2);
}
?>
--EXPECT--
init:a:10
init:b:20
array(2) {
[0]=>
int(11)
[1]=>
int(22)
}
array(2) {
[0]=>
int(13)
[1]=>
int(26)
}