3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function coolPluck($array, $lookup) { $output = array(); foreach($array as $k => $v) { if($k === $lookup &&) { $output[$k][] = $v; } if(is_array($v)) { $results = coolPluck($v, $lookup); if(isset($results[$lookup]) && isset($output[$lookup])) { $output = array_merge((array) $results[$lookup], (array) $output[$lookup]); var_dump($output); } else { $output = array_merge($results, $output); var_dump($output); } } } return $output; } $testArray = array('test' => array('percy' => array('percy' => 'hatcherson'), 'percy' => array('mitchell', 'anderson'))); var_dump(coolPluck($testArray, 'percy'));
Output for 5.3.0 - 5.4.20
Parse error: syntax error, unexpected ')' in /in/UmX0A on line 8
Process exited with code 255.