3v4l.org

run code in 300+ PHP versions simultaneously
<?php class test { protected $val; public function __construct($val) { $this->$val = $val; } } $arr = array( 'one' => new test(10), 'two' => new test(1), 'three' => new test(5) ); uasort($arr, function (test $a, test $b) { if ($a->val == $b->val) { return 0; } return ($a->val < $b->val) ? -1 : 1; });

preferences:
33.53 ms | 402 KiB | 5 Q