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; });
Output for git.master, git.master_jit, rfc.property-hooks
Deprecated: Creation of dynamic property test::$10 is deprecated in /in/2HXtS on line 7 Deprecated: Creation of dynamic property test::$1 is deprecated in /in/2HXtS on line 7 Deprecated: Creation of dynamic property test::$5 is deprecated in /in/2HXtS on line 7 Fatal error: Uncaught Error: Cannot access protected property test::$val in /in/2HXtS:19 Stack trace: #0 [internal function]: {closure}(Object(test), Object(test)) #1 /in/2HXtS(18): uasort(Array, Object(Closure)) #2 {main} thrown in /in/2HXtS on line 19
Process exited with code 255.

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:
41.5 ms | 402 KiB | 8 Q