Arquivos
hhvm/hphp/test/slow/array_for_each/452.php
T
Paul Tarjan c2ec1c97c9 sortof format slow tests
A poor man's formatter since I didn't like any of the other ones I found. The original C++ source sometimes put newlines and sometimes not.

Codemods:

    codemod '([;{}])([^\n])' '\1\n\2'
    codemod -m '\s*<\?php\s+' '<?php\n\n'
    codemod '\t' '  '

I hand-fixed all the failing tests
2013-05-30 17:32:57 -07:00

24 linhas
400 B
PHP

<?php
function f3() {
$i = 0;
$foo = array('a'=>1, 'b'=>2, 'c'=>3, 'd'=>4, 'e'=>5, 'f'=>6);
$bar = array();
$a = 0;
foreach ($foo as $key => &$val) {
yield null;
echo "key=$key val=$val\n";
if ($key == 'b' && $a == 0) {
$a = 1;
unset($foo['c']);
$foo['c'] = 333;
}
++$i;
if ($i >= 20)
break;
}
var_dump($foo);
}
foreach (f3() as $_) {
}