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, 'price'), 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 vHN6i
Output for 7.2.6
1.6927719116211E-5 1.9073486328125E-5 Array ( [0] => Array ( [type] => pork [price] => 5.43 ) [1] => Array ( [type] => fruit [price] => 3.5 ) [2] => Array ( [type] => milk [price] => 2.9 ) ) 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.2.0
9.0599060058594E-6 1.1920928955078E-5 Array ( [0] => Array ( [type] => pork [price] => 5.43 ) [1] => Array ( [type] => fruit [price] => 3.5 ) [2] => Array ( [type] => milk [price] => 2.9 ) ) 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
5.0067901611328E-6 5.9604644775391E-6 Array ( [0] => Array ( [type] => pork [price] => 5.43 ) [1] => Array ( [type] => fruit [price] => 3.5 ) [2] => Array ( [type] => milk [price] => 2.9 ) ) 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
6.9141387939453E-6 1.0013580322266E-5 Array ( [0] => Array ( [type] => pork [price] => 5.43 ) [1] => Array ( [type] => fruit [price] => 3.5 ) [2] => Array ( [type] => milk [price] => 2.9 ) ) 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.2874603271484E-5 Array ( [0] => Array ( [type] => pork [price] => 5.43 ) [1] => Array ( [type] => fruit [price] => 3.5 ) [2] => Array ( [type] => milk [price] => 2.9 ) ) 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.1205673217773E-5 1.2874603271484E-5 Array ( [0] => Array ( [type] => pork [price] => 5.43 ) [1] => Array ( [type] => fruit [price] => 3.5 ) [2] => Array ( [type] => milk [price] => 2.9 ) ) 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 - 7.1.4
1.1920928955078E-5 1.0967254638672E-5 Array ( [0] => Array ( [type] => pork [price] => 5.43 ) [1] => Array ( [type] => fruit [price] => 3.5 ) [2] => Array ( [type] => milk [price] => 2.9 ) ) 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.1920928955078E-5 Array ( [0] => Array ( [type] => pork [price] => 5.43 ) [1] => Array ( [type] => fruit [price] => 3.5 ) [2] => Array ( [type] => milk [price] => 2.9 ) ) 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, 7.1.1
1.5020370483398E-5 1.1920928955078E-5 Array ( [0] => Array ( [type] => pork [price] => 5.43 ) [1] => Array ( [type] => fruit [price] => 3.5 ) [2] => Array ( [type] => milk [price] => 2.9 ) ) 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.2874603271484E-5 1.215934753418E-5 Array ( [0] => Array ( [type] => pork [price] => 5.43 ) [1] => Array ( [type] => fruit [price] => 3.5 ) [2] => Array ( [type] => milk [price] => 2.9 ) ) 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 5.9604644775391E-6 Array ( [0] => Array ( [type] => pork [price] => 5.43 ) [1] => Array ( [type] => fruit [price] => 3.5 ) [2] => Array ( [type] => milk [price] => 2.9 ) ) 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
1.5974044799805E-5 1.1920928955078E-5 Array ( [0] => Array ( [type] => pork [price] => 5.43 ) [1] => Array ( [type] => fruit [price] => 3.5 ) [2] => Array ( [type] => milk [price] => 2.9 ) ) 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.5020370483398E-5 1.215934753418E-5 Array ( [0] => Array ( [type] => pork [price] => 5.43 ) [1] => Array ( [type] => fruit [price] => 3.5 ) [2] => Array ( [type] => milk [price] => 2.9 ) ) 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.4781951904297E-5 1.3113021850586E-5 Array ( [0] => Array ( [type] => pork [price] => 5.43 ) [1] => Array ( [type] => fruit [price] => 3.5 ) [2] => Array ( [type] => milk [price] => 2.9 ) ) 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.5020370483398E-5 1.0013580322266E-5 Array ( [0] => Array ( [type] => pork [price] => 5.43 ) [1] => Array ( [type] => fruit [price] => 3.5 ) [2] => Array ( [type] => milk [price] => 2.9 ) ) 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.15
1.5020370483398E-5 1.5974044799805E-5 Array ( [0] => Array ( [type] => pork [price] => 5.43 ) [1] => Array ( [type] => fruit [price] => 3.5 ) [2] => Array ( [type] => milk [price] => 2.9 ) ) 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.14
1.5974044799805E-5 1.2874603271484E-5 Array ( [0] => Array ( [type] => pork [price] => 5.43 ) [1] => Array ( [type] => fruit [price] => 3.5 ) [2] => Array ( [type] => milk [price] => 2.9 ) ) 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.4781951904297E-5 1.5020370483398E-5 Array ( [0] => Array ( [type] => pork [price] => 5.43 ) [1] => Array ( [type] => fruit [price] => 3.5 ) [2] => Array ( [type] => milk [price] => 2.9 ) ) 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.12
1.3828277587891E-5 1.1920928955078E-5 Array ( [0] => Array ( [type] => pork [price] => 5.43 ) [1] => Array ( [type] => fruit [price] => 3.5 ) [2] => Array ( [type] => milk [price] => 2.9 ) ) 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, 7.0.8, 7.0.10 - 7.0.11
1.4066696166992E-5 1.0967254638672E-5 Array ( [0] => Array ( [type] => pork [price] => 5.43 ) [1] => Array ( [type] => fruit [price] => 3.5 ) [2] => Array ( [type] => milk [price] => 2.9 ) ) 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.0967254638672E-5 Array ( [0] => Array ( [type] => pork [price] => 5.43 ) [1] => Array ( [type] => fruit [price] => 3.5 ) [2] => Array ( [type] => milk [price] => 2.9 ) ) 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
9.7751617431641E-6 1.3828277587891E-5 Array ( [0] => Array ( [type] => pork [price] => 5.43 ) [1] => Array ( [type] => fruit [price] => 3.5 ) [2] => Array ( [type] => milk [price] => 2.9 ) ) 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.0967254638672E-5 Array ( [0] => Array ( [type] => pork [price] => 5.43 ) [1] => Array ( [type] => fruit [price] => 3.5 ) [2] => Array ( [type] => milk [price] => 2.9 ) ) 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.1205673217773E-5 1.1920928955078E-5 Array ( [0] => Array ( [type] => pork [price] => 5.43 ) [1] => Array ( [type] => fruit [price] => 3.5 ) [2] => Array ( [type] => milk [price] => 2.9 ) ) 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.1920928955078E-5 7.1525573730469E-6 Array ( [0] => Array ( [type] => pork [price] => 5.43 ) [1] => Array ( [type] => fruit [price] => 3.5 ) [2] => Array ( [type] => milk [price] => 2.9 ) ) 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.0013580322266E-5 5.9604644775391E-6 Array ( [0] => Array ( [type] => pork [price] => 5.43 ) [1] => Array ( [type] => fruit [price] => 3.5 ) [2] => Array ( [type] => milk [price] => 2.9 ) ) 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
2.9087066650391E-5 1.7881393432617E-5 Array ( [0] => Array ( [type] => pork [price] => 5.43 ) [1] => Array ( [type] => fruit [price] => 3.5 ) [2] => Array ( [type] => milk [price] => 2.9 ) ) 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, 5.6.30
1.0013580322266E-5 1.0013580322266E-5 Array ( [0] => Array ( [type] => pork [price] => 5.43 ) [1] => Array ( [type] => fruit [price] => 3.5 ) [2] => Array ( [type] => milk [price] => 2.9 ) ) 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, 5.6.18, 5.6.29
9.0599060058594E-6 1.0013580322266E-5 Array ( [0] => Array ( [type] => pork [price] => 5.43 ) [1] => Array ( [type] => fruit [price] => 3.5 ) [2] => Array ( [type] => milk [price] => 2.9 ) ) 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.28
1.0967254638672E-5 1.1205673217773E-5 Array ( [0] => Array ( [type] => pork [price] => 5.43 ) [1] => Array ( [type] => fruit [price] => 3.5 ) [2] => Array ( [type] => milk [price] => 2.9 ) ) 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.27
9.0599060058594E-6 1.0967254638672E-5 Array ( [0] => Array ( [type] => pork [price] => 5.43 ) [1] => Array ( [type] => fruit [price] => 3.5 ) [2] => Array ( [type] => milk [price] => 2.9 ) ) 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
8.8214874267578E-6 1.0967254638672E-5 Array ( [0] => Array ( [type] => pork [price] => 5.43 ) [1] => Array ( [type] => fruit [price] => 3.5 ) [2] => Array ( [type] => milk [price] => 2.9 ) ) 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, 5.6.15, 5.6.25
8.8214874267578E-6 9.0599060058594E-6 Array ( [0] => Array ( [type] => pork [price] => 5.43 ) [1] => Array ( [type] => fruit [price] => 3.5 ) [2] => Array ( [type] => milk [price] => 2.9 ) ) 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.5, 5.6.19, 5.6.24
9.0599060058594E-6 8.8214874267578E-6 Array ( [0] => Array ( [type] => pork [price] => 5.43 ) [1] => Array ( [type] => fruit [price] => 3.5 ) [2] => Array ( [type] => milk [price] => 2.9 ) ) 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.23
9.0599060058594E-6 7.8678131103516E-6 Array ( [0] => Array ( [type] => pork [price] => 5.43 ) [1] => Array ( [type] => fruit [price] => 3.5 ) [2] => Array ( [type] => milk [price] => 2.9 ) ) 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.13, 5.6.21
9.0599060058594E-6 9.0599060058594E-6 Array ( [0] => Array ( [type] => pork [price] => 5.43 ) [1] => Array ( [type] => fruit [price] => 3.5 ) [2] => Array ( [type] => milk [price] => 2.9 ) ) 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.17, 5.6.20
8.8214874267578E-6 1.0013580322266E-5 Array ( [0] => Array ( [type] => pork [price] => 5.43 ) [1] => Array ( [type] => fruit [price] => 3.5 ) [2] => Array ( [type] => milk [price] => 2.9 ) ) 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.16
1.0013580322266E-5 8.1062316894531E-6 Array ( [0] => Array ( [type] => pork [price] => 5.43 ) [1] => Array ( [type] => fruit [price] => 3.5 ) [2] => Array ( [type] => milk [price] => 2.9 ) ) 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, 5.6.11 - 5.6.12
1.0013580322266E-5 9.0599060058594E-6 Array ( [0] => Array ( [type] => pork [price] => 5.43 ) [1] => Array ( [type] => fruit [price] => 3.5 ) [2] => Array ( [type] => milk [price] => 2.9 ) ) 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
8.8214874267578E-6 8.1062316894531E-6 Array ( [0] => Array ( [type] => pork [price] => 5.43 ) [1] => Array ( [type] => fruit [price] => 3.5 ) [2] => Array ( [type] => milk [price] => 2.9 ) ) 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.3
9.0599060058594E-6 8.1062316894531E-6 Array ( [0] => Array ( [type] => pork [price] => 5.43 ) [1] => Array ( [type] => fruit [price] => 3.5 ) [2] => Array ( [type] => milk [price] => 2.9 ) ) 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
1.0013580322266E-5 8.8214874267578E-6 Array ( [0] => Array ( [type] => pork [price] => 5.43 ) [1] => Array ( [type] => fruit [price] => 3.5 ) [2] => Array ( [type] => milk [price] => 2.9 ) ) 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.1
1.215934753418E-5 1.0967254638672E-5 Array ( [0] => Array ( [type] => pork [price] => 5.43 ) [1] => Array ( [type] => fruit [price] => 3.5 ) [2] => Array ( [type] => milk [price] => 2.9 ) ) Array ( [fruit] => Array ( [type] => fruit [price] => 3.5 ) [milk] => Array ( [type] => milk [price] => 2.9 ) [pork] => Array ( [type] => pork [price] => 5.43 ) )