3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php foreach ($data as $key => $row) { $volume[$key] = $row['volume']; $edition[$key] = $row['edition']; } print_r($volume); // Sort the data with volume descending, edition ascending // Add $data as the last parameter, to sort by the common key array_multisort($volume, SORT_DESC, $edition, SORT_ASC, $data); print_r($data);
Output for 5.1.0 - 5.6.28, 7.0.0 - 7.1.0
Notice: Undefined variable: data in /in/7J95D on line 2 Warning: Invalid argument supplied for foreach() in /in/7J95D on line 2 Notice: Undefined variable: volume in /in/7J95D on line 6 Warning: array_multisort(): Argument #1 is expected to be an array or a sort flag in /in/7J95D on line 9
Output for hhvm-3.10.0 - 3.13.2
Notice: Undefined variable: data in /in/7J95D on line 5 Warning: Invalid argument supplied for foreach() in /in/7J95D on line 5 Notice: Undefined variable: volume in /in/7J95D on line 6 Warning: Invalid operand type was used: array_multisort expects array(s) in /in/7J95D on line 9
Output for 5.0.4 - 5.0.5
Warning: Invalid argument supplied for foreach() in /in/7J95D on line 2 Notice: Undefined variable: volume in /in/7J95D on line 6 Notice: Undefined variable: volume in /in/7J95D on line 9 Notice: Undefined variable: edition in /in/7J95D on line 9 Warning: array_multisort(): Argument #1 is expected to be an array or a sort flag in /in/7J95D on line 9
Output for 4.3.2 - 4.3.10, 4.4.0 - 5.0.3
Warning: Invalid argument supplied for foreach() in /in/7J95D on line 2 Notice: Undefined variable: volume in /in/7J95D on line 6 Notice: Undefined variable: volume in /in/7J95D on line 9 Notice: Undefined variable: edition in /in/7J95D on line 9 Warning: array_multisort(): Argument #1 is expected to be an array or a sort flag in /in/7J95D on line 9
Output for 4.3.11
Notice: Undefined variable: volume in /in/7J95D on line 6 Notice: Undefined variable: volume in /in/7J95D on line 9 Notice: Undefined variable: edition in /in/7J95D on line 9 Warning: array_multisort(): Argument #1 is expected to be an array or a sort flag in /in/7J95D on line 9
Output for 4.3.0 - 4.3.1
Warning: Invalid argument supplied for foreach() in /in/7J95D on line 2 Notice: Undefined variable: volume in /in/7J95D on line 6 Notice: Undefined variable: volume in /in/7J95D on line 9 Notice: Undefined variable: edition in /in/7J95D on line 9 Warning: array_multisort() [http://www.php.net/function.array-multisort]: Argument #1 is expected to be an array or a sort flag in /in/7J95D on line 9