$op .= "\n"; $i++; } print "{$op}\n"; } function test_do() { print "\ntesting do:\n"; $i = 0; do { $op .= "outer {$i}, "; $j = 0; do { if ($j == 3) { break; } $op .= "inner {$j}, "; $j++; } while ($j < 4); $op .= "\n"; $i++; } while ($i < 4); print "{$op}\n"; } test_foreach(); test_while(); test_for(); test_do(); ?>
function test_both($actual, $expected) { test_foreach($actual, $expected); reset($expected); test_foreach_with_key($actual, $expected); }