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(53), 'two' => new test(200), 'three' => new test(100) ); uasort($arr, function (test $a, test $b) { echo 'comparing '.$a->getVal().' with '.$b->getVal(); 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
comparing 53 with 200 Fatal error: Uncaught Error: Call to undefined method test::val() in /in/0944q:28 Stack trace: #0 [internal function]: {closure}(Object(test), Object(test)) #1 /in/0944q(21): uasort(Array, Object(Closure)) #2 {main} thrown in /in/0944q on line 28
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:
64.1 ms | 401 KiB | 8 Q