3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $array = array( array('name' => 'ifotel', 'value' => '+39080123456' ), array('name' => 'locaton', 'value' => 'Bari') ); $arr = array_column($array, 'value', 'name'); $result = ['telephone'=>'', 'city'=>'']; array_walk($arr, function(&$v, $k) use (&$result){ if ($k == 'infotel') $result['telephone'] = $v; else $result['telephone'] = 'none'; if ($k == 'location') $result['city'] = $v; else $result['city'] = 'none' }); echo $telephone = $result['telephone']; echo "\n"; echo $city = $result['city'];
Output for 5.4.0 - 5.4.30
Parse error: syntax error, unexpected '}' in /in/l4fIM on line 14
Process exited with code 255.
Output for 5.3.0 - 5.3.28
Parse error: syntax error, unexpected '[' in /in/l4fIM on line 8
Process exited with code 255.