3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $array = array( 'one' => range(1,3), range('a', 'c'), 'moo' => array( 'baa' => array('A', 'C'), ), ); function transform(array $array) { foreach ($array as $key => $value) { if (is_array($value)) { yield from transform($value); } else { yield 'JAM_' . $key => $value; } } } $a = iterator_to_array(transform($array)); var_dump($a);
Output for 7.0.0 - 7.2.0
array(3) { ["JAM_0"]=> string(1) "A" ["JAM_1"]=> string(1) "C" ["JAM_2"]=> string(1) "c" }
Output for 5.5.24 - 5.6.28
Parse error: syntax error, unexpected 'transform' (T_STRING) in /in/aYVMF on line 14
Process exited with code 255.
Output for 5.4.11 - 5.4.45
Parse error: syntax error, unexpected 'from' (T_STRING) in /in/aYVMF on line 14
Process exited with code 255.
Output for 5.3.21 - 5.3.29
Parse error: syntax error, unexpected T_STRING in /in/aYVMF on line 14
Process exited with code 255.