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.
22 lines
535 B
22 lines
535 B
<?php
|
|
final class PropertyCounter
|
|
{
|
|
public function value(): int { return 7; }
|
|
}
|
|
final class PropertyCounterHolder
|
|
{
|
|
public PropertyCounter $counter;
|
|
public function __construct() { $this->counter = new PropertyCounter(); }
|
|
public function run(int $count): int
|
|
{
|
|
$sum = 0;
|
|
for ($i = 0; $i < $count; ++$i) {
|
|
$sum += $this->counter->value();
|
|
}
|
|
return $sum;
|
|
}
|
|
}
|
|
function main(int $argc, array $argv): void
|
|
{
|
|
echo (new PropertyCounterHolder())->run(1000000), "\n";
|
|
}
|
|
|