3v4l.org

run code in 300+ PHP versions simultaneously
<?php function cmp( $a, $b ) { if( $a->weight == $b->weight ){ return 0 ; } return ($a->weight < $b->weight) ? -1 : 1; } $unsortedObjectArray = [1,3,5,77,37,523,243,546,14,3,4,6,5]; usort($unsortedObjectArray,'cmp');

preferences:
39.37 ms | 402 KiB | 5 Q