3v4l.org

run code in 300+ PHP versions simultaneously
<?php // SETUP CODE class A { function __construct($val) { $this->val = $val; } } $objs = [ new A(3), new A(5), new A(2), new A(8), new A(1), ]; // AMAZING max_by IMPL :P $res = array_reduce($objs, function ($c, $o) { $p = !is_null($c) ? $c->val : 0; $c = max($o->val, $p); return $o->val == $p ? $o : $c; }, new A(0)); var_dump($res);
Output for git.master, git.master_jit, rfc.property-hooks
Deprecated: Creation of dynamic property A::$val is deprecated in /in/0da10 on line 6 Deprecated: Creation of dynamic property A::$val is deprecated in /in/0da10 on line 6 Deprecated: Creation of dynamic property A::$val is deprecated in /in/0da10 on line 6 Deprecated: Creation of dynamic property A::$val is deprecated in /in/0da10 on line 6 Deprecated: Creation of dynamic property A::$val is deprecated in /in/0da10 on line 6 Deprecated: Creation of dynamic property A::$val is deprecated in /in/0da10 on line 6 Warning: Attempt to read property "val" on int in /in/0da10 on line 20 Warning: Attempt to read property "val" on int in /in/0da10 on line 20 Warning: Attempt to read property "val" on int in /in/0da10 on line 20 Warning: Attempt to read property "val" on int in /in/0da10 on line 20 int(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:
53.3 ms | 403 KiB | 8 Q