3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $ary_main = array( array( "name" => "PSGR004"), array( "name" => "HRCO005"), array( "name" => "HRCO055"), array( "name" => "SAGR110"), array( "name" => "SAGR105"), array( "name" => "SAGR105"), array( "name" => "MAPR161"), array( "name" => "SAGR184") ); $org = $main_ary; $args[] = array(3,4,6,2,0,1,6,1); $args[] = SORT_ASC; $args[] = array("psgr040","hrco055","hrco055","sagr110","sagr105","sagr105","mapr161","sagr184"); $args[] = SORT_DESC; $args[] =& $ary_main; call_user_func_array("array_multisort", $args); foreach($ary_main as $ary) { echo $ary["name"],"\n"; } echo "\n-----------\n"; array_multisort($args[0], $args[1], $args[2], $args[3], $org); foreach($ary_main as $ary) { echo $ary["name"],"\n"; }
Output for 5.0.4 - 5.2.17, 5.3.4 - 5.6.28, 7.0.0 - 7.1.0
Notice: Undefined variable: main_ary in /in/l2g2c on line 14 SAGR105 SAGR184 SAGR105 SAGR110 PSGR004 HRCO005 MAPR161 HRCO055 ----------- Warning: array_multisort(): Argument #5 is expected to be an array or a sort flag in /in/l2g2c on line 33 SAGR105 SAGR184 SAGR105 SAGR110 PSGR004 HRCO005 MAPR161 HRCO055
Output for hhvm-3.12.0
Notice: Undefined variable: main_ary in /in/l2g2c on line 14 SAGR105 SAGR184 SAGR105 SAGR110 PSGR004 HRCO005 MAPR161 HRCO055 ----------- Warning: array_multisort() expects parameter 5 to be integer, null given in /in/l2g2c on line 33 SAGR105 SAGR184 SAGR105 SAGR110 PSGR004 HRCO005 MAPR161 HRCO055
Output for hhvm-3.10.0
Notice: Undefined variable: main_ary in /in/l2g2c on line -1 SAGR105 SAGR184 SAGR105 SAGR110 PSGR004 HRCO005 MAPR161 HRCO055 ----------- SAGR105 SAGR184 SAGR105 SAGR110 PSGR004 HRCO005 MAPR161 HRCO055
Output for 5.3.0 - 5.3.3
Notice: Undefined variable: main_ary in /in/l2g2c on line 14 Warning: Parameter 1 to array_multisort() expected to be a reference, value given in /in/l2g2c on line 23 PSGR004 HRCO005 HRCO055 SAGR110 SAGR105 SAGR105 MAPR161 SAGR184 ----------- Warning: array_multisort(): Argument #5 is expected to be an array or a sort flag in /in/l2g2c on line 33 PSGR004 HRCO005 HRCO055 SAGR110 SAGR105 SAGR105 MAPR161 SAGR184
Output for 4.3.2 - 5.0.3
Notice: Undefined variable: main_ary in /in/l2g2c on line 14 SAGR105 SAGR184 SAGR105 SAGR110 PSGR004 HRCO005 MAPR161 HRCO055 ----------- Warning: array_multisort(): Argument #5 is expected to be an array or a sort flag in /in/l2g2c on line 33 SAGR105 SAGR184 SAGR105 SAGR110 PSGR004 HRCO005 MAPR161 HRCO055
Output for 4.3.0 - 4.3.1
Notice: Undefined variable: main_ary in /in/l2g2c on line 14 SAGR105 SAGR184 SAGR105 SAGR110 PSGR004 HRCO005 MAPR161 HRCO055 ----------- Warning: array_multisort() [http://www.php.net/function.array-multisort]: Argument #5 is expected to be an array or a sort flag in /in/l2g2c on line 33 SAGR105 SAGR184 SAGR105 SAGR110 PSGR004 HRCO005 MAPR161 HRCO055