Arquivos
hhvm/hphp/test/slow/array_for_each/463.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

25 linhas
395 B
PHP

<?php
function f9() {
$i = 0;
$arr = array(1,1,1);
$bar = array();
$first = true;
foreach ($arr as $k => &$v) {
echo "k=$k v=$v\n";
if (!$first) {
$prev_k = ($k+2)%3;
unset($arr[$prev_k]);
if (count($bar) > 100)
$bar = array();
$bar[] = 1;
$arr[$prev_k] = 1;
}
$first = false;
++$i;
if ($i >= 20)
break;
}
}
f9();