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
676 B
42 lines
676 B
--TEST--
|
|
Goto and label statements
|
|
--FILE--
|
|
<?php
|
|
|
|
function main() {
|
|
$result = 0;
|
|
|
|
// Forward goto
|
|
goto forward;
|
|
$result += 100; // skipped
|
|
forward:
|
|
$result += 1;
|
|
|
|
// Backward goto
|
|
$i = 0;
|
|
loop_start:
|
|
$i++;
|
|
if ($i < 10) {
|
|
goto loop_start;
|
|
}
|
|
$result += $i;
|
|
|
|
// Goto out of nested structure
|
|
$found = false;
|
|
for ($j = 0; $j < 5; $j++) {
|
|
for ($k = 0; $k < 5; $k++) {
|
|
if ($j == 3 && $k == 2) {
|
|
$found = true;
|
|
goto found_label;
|
|
}
|
|
}
|
|
}
|
|
found_label:
|
|
$result += ($found ? 10 : 0);
|
|
|
|
var_dump($result);
|
|
}
|
|
|
|
?>
|
|
--EXPECT--
|
|
int(21)
|
|
|