3v4l.org

run code in 300+ PHP versions simultaneously
<?php class test { protected $val; public function __construct($val) { $this->$val = $val; } public function getVal() { return $this->val; } } $arr = array( 'one' => new test(3), 'two' => new test(2), 'three' => new test(1) ); uasort($arr, function (test $a, test $b) { if ($a->getVal() == $b->getVal()) { return 0; } return ($a->getVal() < $b->val()) ? -1 : 1; }); print_r($arr);
Output for git.master, git.master_jit, rfc.property-hooks
Deprecated: Creation of dynamic property test::$3 is deprecated in /in/qZ4g2 on line 7 Deprecated: Creation of dynamic property test::$2 is deprecated in /in/qZ4g2 on line 7 Deprecated: Creation of dynamic property test::$1 is deprecated in /in/qZ4g2 on line 7 Array ( [one] => test Object ( [val:protected] => [3] => 3 ) [two] => test Object ( [val:protected] => [2] => 2 ) [three] => test Object ( [val:protected] => [1] => 1 ) )

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
25.36 ms | 402 KiB | 8 Q