3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $testArray = array( 'percy' => array( 'philip' => array( 'mitch' => array( 'percy' => 'hatcherson', 'mitch' => 'anderson' ) ), 'mitch' => array( 'mitchell', 'anderson', 'percy' => array( 'percy', 'hatcherson' ), 'mitchell' => 'thomas mitchell anderson', 'percy' => 'percy philip hatcherson' ) ) ); $newArray = array(); function recursiveArrayColumn ($array, $index, $helper = array()) { $helper = array_column($v, $index); foreach ($array as $k => $v) { if (is_array($v)) { $helper[] = recursiveArrayColumn($v, $index, $helper) } } } var_dump(recursiveArrayColumn($testArray, 'percy'));
Output for 5.3.0 - 5.4.20
Parse error: syntax error, unexpected '}' in /in/Bd5vm on line 35
Process exited with code 255.