3v4l.org

run code in 200+ php & hhvm versions
<?php $data = array( array('id' => 1, 'price' => 100), array('id' => 7, 'price' => 100.3), array('id' => 5, 'price' => 100.2), ); uasort($data, function ($a, $b) { return $a['price'] - $b['price']; }); var_dump($data); uasort($data, function ($a, $b) { return $a['price'] <=> $b['price']; }); var_dump($data);
Output for 7.0.0 - 7.3.1
array(3) { [0]=> array(2) { ["id"]=> int(1) ["price"]=> int(100) } [1]=> array(2) { ["id"]=> int(7) ["price"]=> float(100.3) } [2]=> array(2) { ["id"]=> int(5) ["price"]=> float(100.2) } } array(3) { [0]=> array(2) { ["id"]=> int(1) ["price"]=> int(100) } [2]=> array(2) { ["id"]=> int(5) ["price"]=> float(100.2) } [1]=> array(2) { ["id"]=> int(7) ["price"]=> float(100.3) } }
Output for 5.3.0 - 5.6.28
Parse error: syntax error, unexpected '>' in /in/YTYP8 on line 13
Process exited with code 255.
Output for 4.4.2 - 4.4.9, 5.1.0 - 5.2.17
Parse error: syntax error, unexpected T_FUNCTION in /in/YTYP8 on line 7
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1, 5.0.0 - 5.0.5
Parse error: parse error, unexpected T_FUNCTION in /in/YTYP8 on line 7
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/YTYP8 on line 7
Process exited with code 255.