3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { public $foo; public function &bar1() { return $this; } public function bar2($o) { $x &= $this->bar1(); $x = $o; } } $a = new Foo; $a->foo = 1; $b = new Foo; $b->foo = 2; var_dump($a->foo, $b->foo); $a->bar2($b); var_dump($a->foo, $b->foo);
Output for git.master, git.master_jit, rfc.property-hooks
int(1) int(2) Warning: Undefined variable $x in /in/F08Xe on line 5 Fatal error: Uncaught TypeError: Unsupported operand types: null & Foo in /in/F08Xe:5 Stack trace: #0 /in/F08Xe(15): Foo->bar2(Object(Foo)) #1 {main} thrown in /in/F08Xe on line 5
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:
35.89 ms | 401 KiB | 8 Q