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 < $y){ return 1; }else if($x > $y){ return -1; }else if($x == $y){ return 0; } } usort($pro,"compare"); print_r($pro); ?>
Output for 4.3.0 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
Array ( [0] => 12 [1] => 10 [2] => 1 )