php2go/fixtures/0002-loops.php

26 lines
358 B
PHP
Raw Permalink Normal View History

2020-04-05 04:35:44 +00:00
<?php
// Different types of loop statement
for($i = 0; $i < 3; ++$i) {
foreach($foo as $k => $v) {
}
foreach($foo2 as $v2) {
}
2020-04-07 06:27:20 +00:00
while(true /* infinite. */) {
2020-04-05 04:35:44 +00:00
}
do {
} while (true);
}
// Loop with no separate body statement
while (true) echo "hello";
// Loop with multiple initialiser conditions
for ($i = 0, $e = 3; $i < $e; ++$i) {
}