3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $data = array( array("type"=>"fruit", "price"=>3.50), array("type"=>"milk", "price"=>2.90), array("type"=>"pork", "price"=>5.43), ); $inventory = $data; $time = microtime(true); array_multisort(array_column($inventory, 'type'), SORT_DESC, $inventory); echo microtime(true)-$time; echo "\n\n"; $new = []; $time = microtime(true); foreach($data as $row){ $new[$row['type']] = $row; } ksort($new); echo microtime(true)-$time; echo "\n\n"; print_r($inventory); print_r($new);
based on a2deE
Output for 7.2.6
1.0013580322266E-5 1.2874603271484E-5 Array ( [0] => Array ( [type] => pork [price] => 5.43 ) [1] => Array ( [type] => milk [price] => 2.9 ) [2] => Array ( [type] => fruit [price] => 3.5 ) ) Array ( [fruit] => Array ( [type] => fruit [price] => 3.5 ) [milk] => Array ( [type] => milk [price] => 2.9 ) [pork] => Array ( [type] => pork [price] => 5.43 ) )
Output for 7.2.0
8.8214874267578E-6 1.0013580322266E-5 Array ( [0] => Array ( [type] => pork [price] => 5.43 ) [1] => Array ( [type] => milk [price] => 2.9 ) [2] => Array ( [type] => fruit [price] => 3.5 ) ) Array ( [fruit] => Array ( [type] => fruit [price] => 3.5 ) [milk] => Array ( [type] => milk [price] => 2.9 ) [pork] => Array ( [type] => pork [price] => 5.43 ) )
Output for 7.1.10
6.9141387939453E-6 1.215934753418E-5 Array ( [0] => Array ( [type] => pork [price] => 5.43 ) [1] => Array ( [type] => milk [price] => 2.9 ) [2] => Array ( [type] => fruit [price] => 3.5 ) ) Array ( [fruit] => Array ( [type] => fruit [price] => 3.5 ) [milk] => Array ( [type] => milk [price] => 2.9 ) [pork] => Array ( [type] => pork [price] => 5.43 ) )
Output for 7.1.7
8.8214874267578E-6 1.1920928955078E-5 Array ( [0] => Array ( [type] => pork [price] => 5.43 ) [1] => Array ( [type] => milk [price] => 2.9 ) [2] => Array ( [type] => fruit [price] => 3.5 ) ) Array ( [fruit] => Array ( [type] => fruit [price] => 3.5 ) [milk] => Array ( [type] => milk [price] => 2.9 ) [pork] => Array ( [type] => pork [price] => 5.43 ) )
Output for 7.1.6
1.1920928955078E-5 1.1205673217773E-5 Array ( [0] => Array ( [type] => pork [price] => 5.43 ) [1] => Array ( [type] => milk [price] => 2.9 ) [2] => Array ( [type] => fruit [price] => 3.5 ) ) Array ( [fruit] => Array ( [type] => fruit [price] => 3.5 ) [milk] => Array ( [type] => milk [price] => 2.9 ) [pork] => Array ( [type] => pork [price] => 5.43 ) )
Output for 7.1.5
1.2874603271484E-5 1.0967254638672E-5 Array ( [0] => Array ( [type] => pork [price] => 5.43 ) [1] => Array ( [type] => milk [price] => 2.9 ) [2] => Array ( [type] => fruit [price] => 3.5 ) ) Array ( [fruit] => Array ( [type] => fruit [price] => 3.5 ) [milk] => Array ( [type] => milk [price] => 2.9 ) [pork] => Array ( [type] => pork [price] => 5.43 ) )
Output for 7.1.4
1.1920928955078E-5 1.0967254638672E-5 Array ( [0] => Array ( [type] => pork [price] => 5.43 ) [1] => Array ( [type] => milk [price] => 2.9 ) [2] => Array ( [type] => fruit [price] => 3.5 ) ) Array ( [fruit] => Array ( [type] => fruit [price] => 3.5 ) [milk] => Array ( [type] => milk [price] => 2.9 ) [pork] => Array ( [type] => pork [price] => 5.43 ) )
Output for 7.1.3
1.5974044799805E-5 1.4066696166992E-5 Array ( [0] => Array ( [type] => pork [price] => 5.43 ) [1] => Array ( [type] => milk [price] => 2.9 ) [2] => Array ( [type] => fruit [price] => 3.5 ) ) Array ( [fruit] => Array ( [type] => fruit [price] => 3.5 ) [milk] => Array ( [type] => milk [price] => 2.9 ) [pork] => Array ( [type] => pork [price] => 5.43 ) )
Output for 7.1.2
1.215934753418E-5 1.0967254638672E-5 Array ( [0] => Array ( [type] => pork [price] => 5.43 ) [1] => Array ( [type] => milk [price] => 2.9 ) [2] => Array ( [type] => fruit [price] => 3.5 ) ) Array ( [fruit] => Array ( [type] => fruit [price] => 3.5 ) [milk] => Array ( [type] => milk [price] => 2.9 ) [pork] => Array ( [type] => pork [price] => 5.43 ) )
Output for 7.1.1
1.5974044799805E-5 1.5974044799805E-5 Array ( [0] => Array ( [type] => pork [price] => 5.43 ) [1] => Array ( [type] => milk [price] => 2.9 ) [2] => Array ( [type] => fruit [price] => 3.5 ) ) Array ( [fruit] => Array ( [type] => fruit [price] => 3.5 ) [milk] => Array ( [type] => milk [price] => 2.9 ) [pork] => Array ( [type] => pork [price] => 5.43 ) )
Output for 7.1.0
1.1920928955078E-5 1.0013580322266E-5 Array ( [0] => Array ( [type] => pork [price] => 5.43 ) [1] => Array ( [type] => milk [price] => 2.9 ) [2] => Array ( [type] => fruit [price] => 3.5 ) ) Array ( [fruit] => Array ( [type] => fruit [price] => 3.5 ) [milk] => Array ( [type] => milk [price] => 2.9 ) [pork] => Array ( [type] => pork [price] => 5.43 ) )
Output for 7.0.20
1.4066696166992E-5 3.1948089599609E-5 Array ( [0] => Array ( [type] => pork [price] => 5.43 ) [1] => Array ( [type] => milk [price] => 2.9 ) [2] => Array ( [type] => fruit [price] => 3.5 ) ) Array ( [fruit] => Array ( [type] => fruit [price] => 3.5 ) [milk] => Array ( [type] => milk [price] => 2.9 ) [pork] => Array ( [type] => pork [price] => 5.43 ) )
Output for 7.0.19
2.288818359375E-5 1.3113021850586E-5 Array ( [0] => Array ( [type] => pork [price] => 5.43 ) [1] => Array ( [type] => milk [price] => 2.9 ) [2] => Array ( [type] => fruit [price] => 3.5 ) ) Array ( [fruit] => Array ( [type] => fruit [price] => 3.5 ) [milk] => Array ( [type] => milk [price] => 2.9 ) [pork] => Array ( [type] => pork [price] => 5.43 ) )
Output for 7.0.18
1.9073486328125E-5 1.5974044799805E-5 Array ( [0] => Array ( [type] => pork [price] => 5.43 ) [1] => Array ( [type] => milk [price] => 2.9 ) [2] => Array ( [type] => fruit [price] => 3.5 ) ) Array ( [fruit] => Array ( [type] => fruit [price] => 3.5 ) [milk] => Array ( [type] => milk [price] => 2.9 ) [pork] => Array ( [type] => pork [price] => 5.43 ) )
Output for 7.0.17
1.7881393432617E-5 1.5020370483398E-5 Array ( [0] => Array ( [type] => pork [price] => 5.43 ) [1] => Array ( [type] => milk [price] => 2.9 ) [2] => Array ( [type] => fruit [price] => 3.5 ) ) Array ( [fruit] => Array ( [type] => fruit [price] => 3.5 ) [milk] => Array ( [type] => milk [price] => 2.9 ) [pork] => Array ( [type] => pork [price] => 5.43 ) )
Output for 7.0.16
1.4066696166992E-5 9.0599060058594E-6 Array ( [0] => Array ( [type] => pork [price] => 5.43 ) [1] => Array ( [type] => milk [price] => 2.9 ) [2] => Array ( [type] => fruit [price] => 3.5 ) ) Array ( [fruit] => Array ( [type] => fruit [price] => 3.5 ) [milk] => Array ( [type] => milk [price] => 2.9 ) [pork] => Array ( [type] => pork [price] => 5.43 ) )
Output for 7.0.1, 7.0.12, 7.0.14 - 7.0.15
1.5020370483398E-5 1.1920928955078E-5 Array ( [0] => Array ( [type] => pork [price] => 5.43 ) [1] => Array ( [type] => milk [price] => 2.9 ) [2] => Array ( [type] => fruit [price] => 3.5 ) ) Array ( [fruit] => Array ( [type] => fruit [price] => 3.5 ) [milk] => Array ( [type] => milk [price] => 2.9 ) [pork] => Array ( [type] => pork [price] => 5.43 ) )
Output for 7.0.13
1.5974044799805E-5 1.1920928955078E-5 Array ( [0] => Array ( [type] => pork [price] => 5.43 ) [1] => Array ( [type] => milk [price] => 2.9 ) [2] => Array ( [type] => fruit [price] => 3.5 ) ) Array ( [fruit] => Array ( [type] => fruit [price] => 3.5 ) [milk] => Array ( [type] => milk [price] => 2.9 ) [pork] => Array ( [type] => pork [price] => 5.43 ) )
Output for 7.0.11
1.3828277587891E-5 1.0013580322266E-5 Array ( [0] => Array ( [type] => pork [price] => 5.43 ) [1] => Array ( [type] => milk [price] => 2.9 ) [2] => Array ( [type] => fruit [price] => 3.5 ) ) Array ( [fruit] => Array ( [type] => fruit [price] => 3.5 ) [milk] => Array ( [type] => milk [price] => 2.9 ) [pork] => Array ( [type] => pork [price] => 5.43 ) )
Output for 7.0.10
1.5020370483398E-5 1.1205673217773E-5 Array ( [0] => Array ( [type] => pork [price] => 5.43 ) [1] => Array ( [type] => milk [price] => 2.9 ) [2] => Array ( [type] => fruit [price] => 3.5 ) ) Array ( [fruit] => Array ( [type] => fruit [price] => 3.5 ) [milk] => Array ( [type] => milk [price] => 2.9 ) [pork] => Array ( [type] => pork [price] => 5.43 ) )
Output for 7.0.9
1.5020370483398E-5 1.0013580322266E-5 Array ( [0] => Array ( [type] => pork [price] => 5.43 ) [1] => Array ( [type] => milk [price] => 2.9 ) [2] => Array ( [type] => fruit [price] => 3.5 ) ) Array ( [fruit] => Array ( [type] => fruit [price] => 3.5 ) [milk] => Array ( [type] => milk [price] => 2.9 ) [pork] => Array ( [type] => pork [price] => 5.43 ) )
Output for 7.0.8
1.5020370483398E-5 1.0967254638672E-5 Array ( [0] => Array ( [type] => pork [price] => 5.43 ) [1] => Array ( [type] => milk [price] => 2.9 ) [2] => Array ( [type] => fruit [price] => 3.5 ) ) Array ( [fruit] => Array ( [type] => fruit [price] => 3.5 ) [milk] => Array ( [type] => milk [price] => 2.9 ) [pork] => Array ( [type] => pork [price] => 5.43 ) )
Output for 7.0.7
1.6212463378906E-5 1.0967254638672E-5 Array ( [0] => Array ( [type] => pork [price] => 5.43 ) [1] => Array ( [type] => milk [price] => 2.9 ) [2] => Array ( [type] => fruit [price] => 3.5 ) ) Array ( [fruit] => Array ( [type] => fruit [price] => 3.5 ) [milk] => Array ( [type] => milk [price] => 2.9 ) [pork] => Array ( [type] => pork [price] => 5.43 ) )
Output for 7.0.6
1.4781951904297E-5 1.0967254638672E-5 Array ( [0] => Array ( [type] => pork [price] => 5.43 ) [1] => Array ( [type] => milk [price] => 2.9 ) [2] => Array ( [type] => fruit [price] => 3.5 ) ) Array ( [fruit] => Array ( [type] => fruit [price] => 3.5 ) [milk] => Array ( [type] => milk [price] => 2.9 ) [pork] => Array ( [type] => pork [price] => 5.43 ) )
Output for 7.0.5
1.0967254638672E-5 1.0967254638672E-5 Array ( [0] => Array ( [type] => pork [price] => 5.43 ) [1] => Array ( [type] => milk [price] => 2.9 ) [2] => Array ( [type] => fruit [price] => 3.5 ) ) Array ( [fruit] => Array ( [type] => fruit [price] => 3.5 ) [milk] => Array ( [type] => milk [price] => 2.9 ) [pork] => Array ( [type] => pork [price] => 5.43 ) )
Output for 7.0.4
1.0967254638672E-5 1.0013580322266E-5 Array ( [0] => Array ( [type] => pork [price] => 5.43 ) [1] => Array ( [type] => milk [price] => 2.9 ) [2] => Array ( [type] => fruit [price] => 3.5 ) ) Array ( [fruit] => Array ( [type] => fruit [price] => 3.5 ) [milk] => Array ( [type] => milk [price] => 2.9 ) [pork] => Array ( [type] => pork [price] => 5.43 ) )
Output for 7.0.3
1.0013580322266E-5 1.0967254638672E-5 Array ( [0] => Array ( [type] => pork [price] => 5.43 ) [1] => Array ( [type] => milk [price] => 2.9 ) [2] => Array ( [type] => fruit [price] => 3.5 ) ) Array ( [fruit] => Array ( [type] => fruit [price] => 3.5 ) [milk] => Array ( [type] => milk [price] => 2.9 ) [pork] => Array ( [type] => pork [price] => 5.43 ) )
Output for 7.0.2
1.0967254638672E-5 5.0067901611328E-6 Array ( [0] => Array ( [type] => pork [price] => 5.43 ) [1] => Array ( [type] => milk [price] => 2.9 ) [2] => Array ( [type] => fruit [price] => 3.5 ) ) Array ( [fruit] => Array ( [type] => fruit [price] => 3.5 ) [milk] => Array ( [type] => milk [price] => 2.9 ) [pork] => Array ( [type] => pork [price] => 5.43 ) )
Output for 7.0.0
1.0967254638672E-5 6.1988830566406E-6 Array ( [0] => Array ( [type] => pork [price] => 5.43 ) [1] => Array ( [type] => milk [price] => 2.9 ) [2] => Array ( [type] => fruit [price] => 3.5 ) ) Array ( [fruit] => Array ( [type] => fruit [price] => 3.5 ) [milk] => Array ( [type] => milk [price] => 2.9 ) [pork] => Array ( [type] => pork [price] => 5.43 ) )
Output for hhvm-3.15.4
3.0994415283203E-5 1.8119812011719E-5 Array ( [0] => Array ( [type] => pork [price] => 5.43 ) [1] => Array ( [type] => milk [price] => 2.9 ) [2] => Array ( [type] => fruit [price] => 3.5 ) ) Array ( [fruit] => Array ( [type] => fruit [price] => 3.5 ) [milk] => Array ( [type] => milk [price] => 2.9 ) [pork] => Array ( [type] => pork [price] => 5.43 ) )
Output for 5.6.15, 5.6.30
1.0967254638672E-5 9.0599060058594E-6 Array ( [0] => Array ( [type] => pork [price] => 5.43 ) [1] => Array ( [type] => milk [price] => 2.9 ) [2] => Array ( [type] => fruit [price] => 3.5 ) ) Array ( [fruit] => Array ( [type] => fruit [price] => 3.5 ) [milk] => Array ( [type] => milk [price] => 2.9 ) [pork] => Array ( [type] => pork [price] => 5.43 ) )
Output for 5.6.29
8.8214874267578E-6 8.1062316894531E-6 Array ( [0] => Array ( [type] => pork [price] => 5.43 ) [1] => Array ( [type] => milk [price] => 2.9 ) [2] => Array ( [type] => fruit [price] => 3.5 ) ) Array ( [fruit] => Array ( [type] => fruit [price] => 3.5 ) [milk] => Array ( [type] => milk [price] => 2.9 ) [pork] => Array ( [type] => pork [price] => 5.43 ) )
Output for 5.6.7, 5.6.13, 5.6.28
1.0013580322266E-5 7.8678131103516E-6 Array ( [0] => Array ( [type] => pork [price] => 5.43 ) [1] => Array ( [type] => milk [price] => 2.9 ) [2] => Array ( [type] => fruit [price] => 3.5 ) ) Array ( [fruit] => Array ( [type] => fruit [price] => 3.5 ) [milk] => Array ( [type] => milk [price] => 2.9 ) [pork] => Array ( [type] => pork [price] => 5.43 ) )
Output for 5.6.9, 5.6.12, 5.6.27
1.0013580322266E-5 8.8214874267578E-6 Array ( [0] => Array ( [type] => pork [price] => 5.43 ) [1] => Array ( [type] => milk [price] => 2.9 ) [2] => Array ( [type] => fruit [price] => 3.5 ) ) Array ( [fruit] => Array ( [type] => fruit [price] => 3.5 ) [milk] => Array ( [type] => milk [price] => 2.9 ) [pork] => Array ( [type] => pork [price] => 5.43 ) )
Output for 5.6.26
1.215934753418E-5 9.0599060058594E-6 Array ( [0] => Array ( [type] => pork [price] => 5.43 ) [1] => Array ( [type] => milk [price] => 2.9 ) [2] => Array ( [type] => fruit [price] => 3.5 ) ) Array ( [fruit] => Array ( [type] => fruit [price] => 3.5 ) [milk] => Array ( [type] => milk [price] => 2.9 ) [pork] => Array ( [type] => pork [price] => 5.43 ) )
Output for 5.6.22, 5.6.25
9.0599060058594E-6 8.1062316894531E-6 Array ( [0] => Array ( [type] => pork [price] => 5.43 ) [1] => Array ( [type] => milk [price] => 2.9 ) [2] => Array ( [type] => fruit [price] => 3.5 ) ) Array ( [fruit] => Array ( [type] => fruit [price] => 3.5 ) [milk] => Array ( [type] => milk [price] => 2.9 ) [pork] => Array ( [type] => pork [price] => 5.43 ) )
Output for 5.6.24
8.8214874267578E-6 7.8678131103516E-6 Array ( [0] => Array ( [type] => pork [price] => 5.43 ) [1] => Array ( [type] => milk [price] => 2.9 ) [2] => Array ( [type] => fruit [price] => 3.5 ) ) Array ( [fruit] => Array ( [type] => fruit [price] => 3.5 ) [milk] => Array ( [type] => milk [price] => 2.9 ) [pork] => Array ( [type] => pork [price] => 5.43 ) )
Output for 5.6.23
1.0967254638672E-5 7.8678131103516E-6 Array ( [0] => Array ( [type] => pork [price] => 5.43 ) [1] => Array ( [type] => milk [price] => 2.9 ) [2] => Array ( [type] => fruit [price] => 3.5 ) ) Array ( [fruit] => Array ( [type] => fruit [price] => 3.5 ) [milk] => Array ( [type] => milk [price] => 2.9 ) [pork] => Array ( [type] => pork [price] => 5.43 ) )
Output for 5.6.21
9.0599060058594E-6 6.9141387939453E-6 Array ( [0] => Array ( [type] => pork [price] => 5.43 ) [1] => Array ( [type] => milk [price] => 2.9 ) [2] => Array ( [type] => fruit [price] => 3.5 ) ) Array ( [fruit] => Array ( [type] => fruit [price] => 3.5 ) [milk] => Array ( [type] => milk [price] => 2.9 ) [pork] => Array ( [type] => pork [price] => 5.43 ) )
Output for 5.6.4 - 5.6.5, 5.6.16, 5.6.18, 5.6.20
9.0599060058594E-6 7.8678131103516E-6 Array ( [0] => Array ( [type] => pork [price] => 5.43 ) [1] => Array ( [type] => milk [price] => 2.9 ) [2] => Array ( [type] => fruit [price] => 3.5 ) ) Array ( [fruit] => Array ( [type] => fruit [price] => 3.5 ) [milk] => Array ( [type] => milk [price] => 2.9 ) [pork] => Array ( [type] => pork [price] => 5.43 ) )
Output for 5.6.2, 5.6.17, 5.6.19
1.0013580322266E-5 9.0599060058594E-6 Array ( [0] => Array ( [type] => pork [price] => 5.43 ) [1] => Array ( [type] => milk [price] => 2.9 ) [2] => Array ( [type] => fruit [price] => 3.5 ) ) Array ( [fruit] => Array ( [type] => fruit [price] => 3.5 ) [milk] => Array ( [type] => milk [price] => 2.9 ) [pork] => Array ( [type] => pork [price] => 5.43 ) )
Output for 5.6.14
1.3113021850586E-5 1.0967254638672E-5 Array ( [0] => Array ( [type] => pork [price] => 5.43 ) [1] => Array ( [type] => milk [price] => 2.9 ) [2] => Array ( [type] => fruit [price] => 3.5 ) ) Array ( [fruit] => Array ( [type] => fruit [price] => 3.5 ) [milk] => Array ( [type] => milk [price] => 2.9 ) [pork] => Array ( [type] => pork [price] => 5.43 ) )
Output for 5.6.11
9.0599060058594E-6 9.0599060058594E-6 Array ( [0] => Array ( [type] => pork [price] => 5.43 ) [1] => Array ( [type] => milk [price] => 2.9 ) [2] => Array ( [type] => fruit [price] => 3.5 ) ) Array ( [fruit] => Array ( [type] => fruit [price] => 3.5 ) [milk] => Array ( [type] => milk [price] => 2.9 ) [pork] => Array ( [type] => pork [price] => 5.43 ) )
Output for 5.6.10
9.0599060058594E-6 8.8214874267578E-6 Array ( [0] => Array ( [type] => pork [price] => 5.43 ) [1] => Array ( [type] => milk [price] => 2.9 ) [2] => Array ( [type] => fruit [price] => 3.5 ) ) Array ( [fruit] => Array ( [type] => fruit [price] => 3.5 ) [milk] => Array ( [type] => milk [price] => 2.9 ) [pork] => Array ( [type] => pork [price] => 5.43 ) )
Output for 5.6.8
1.1920928955078E-5 8.1062316894531E-6 Array ( [0] => Array ( [type] => pork [price] => 5.43 ) [1] => Array ( [type] => milk [price] => 2.9 ) [2] => Array ( [type] => fruit [price] => 3.5 ) ) Array ( [fruit] => Array ( [type] => fruit [price] => 3.5 ) [milk] => Array ( [type] => milk [price] => 2.9 ) [pork] => Array ( [type] => pork [price] => 5.43 ) )
Output for 5.6.6
8.8214874267578E-6 2.7894973754883E-5 Array ( [0] => Array ( [type] => pork [price] => 5.43 ) [1] => Array ( [type] => milk [price] => 2.9 ) [2] => Array ( [type] => fruit [price] => 3.5 ) ) Array ( [fruit] => Array ( [type] => fruit [price] => 3.5 ) [milk] => Array ( [type] => milk [price] => 2.9 ) [pork] => Array ( [type] => pork [price] => 5.43 ) )
Output for 5.6.0 - 5.6.1, 5.6.3
1.0013580322266E-5 8.1062316894531E-6 Array ( [0] => Array ( [type] => pork [price] => 5.43 ) [1] => Array ( [type] => milk [price] => 2.9 ) [2] => Array ( [type] => fruit [price] => 3.5 ) ) Array ( [fruit] => Array ( [type] => fruit [price] => 3.5 ) [milk] => Array ( [type] => milk [price] => 2.9 ) [pork] => Array ( [type] => pork [price] => 5.43 ) )