3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $products = array( array('TIR','tire',10), array('OIL','oil',100), array('SPK','spark',20) ); $pro = array(10,12,1); function compare($x,$y){ if($x[2] < $y[2]){ return 1; }else if($x > $y){ return -1; }else if($x[2] == $y[2]){ return 0; } } usort($pro,"compare"); print_r($pro); ?>
Output for hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
Array ( [0] => 10 [1] => 12 [2] => 1 )
Output for 4.3.0 - 5.6.28
Array ( [0] => 1 [1] => 12 [2] => 10 )