<?php
$a = [
1,2,3,
[4,5],
[6,7],
];
$f = function (array $array) use (&$f) {
if (is_array($array)) {
yield from f($array);
} else {
yield $array
}
};
foreach ($f($a) as $v) {
echo $v;
}
- Output for 7.0.0 - 7.0.1
- Parse error: syntax error, unexpected '}' in /in/vnfAK on line 14
Process exited with code 255. - Output for 5.5.24 - 5.5.30, 5.6.8 - 5.6.16
- Parse error: syntax error, unexpected 'f' (T_STRING) in /in/vnfAK on line 11
Process exited with code 255.
preferences:
165.39 ms | 1387 KiB | 25 Q