3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $arr = array('test' => array('percy' => array('hello' => 'hatcherson'), 'percy' => array('mitchell', 'anderson'))); $allowed = array('percy'); $combined = array(); $combined[] = array_intersect_key($arr, array_flip($allowed)) foreach ($arr as $k => $v) { if (is_array($v)) { $combined[] = array_intersect_key($arr[$k], array_flip($allowed)); } } var_dump($combined);
Output for 5.4.0 - 5.5.4
Parse error: syntax error, unexpected 'foreach' (T_FOREACH) in /in/g9iYe on line 9
Process exited with code 255.
Output for 5.3.0 - 5.3.27
Parse error: syntax error, unexpected T_FOREACH in /in/g9iYe on line 9
Process exited with code 255.