3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $array = array( array('name' => 'Apple', 'json' => '{"type":"Fruit","sortOrder":2}') array('name' => 'Potato', 'json' => '{"type":"Fruit","sortOrder":1}') ); $array = array_map(function (array $values) { $json = json_decode($values['json'], true); return $values + array('sortOrder' => $json['SortOrder']); }, $array); usort($array, function (array $a, array $b) { return $a['sortOrder'] - $b['sortOrder']; }); $array = array_map(function (array $values) { unset($values['sortOrder']); return $values; }, $array); var_dump($array);
Output for 5.4.0 - 5.4.26
Parse error: syntax error, unexpected 'array' (T_ARRAY), expecting ')' in /in/I6OYt on line 5
Process exited with code 255.
Output for 4.4.2 - 4.4.9, 5.1.0 - 5.3.28
Parse error: syntax error, unexpected T_ARRAY, expecting ')' in /in/I6OYt on line 5
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1, 5.0.0 - 5.0.5
Parse error: parse error, unexpected T_ARRAY, expecting ')' in /in/I6OYt on line 5
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error, expecting `')'' in /in/I6OYt on line 5
Process exited with code 255.