3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { public function add($val = 0) { $this->stuff[] = $val; } } $x = new Foo(); $x->add(42); echo serialize($x) . "\n"; var_dump($x); echo "\n\n"; class Bar { private $stuff = []; public function add($x = 0) { $this->stuff[] = $x; } } $x = new Bar(); $x->add(42); echo serialize($x) . "\n"; var_dump($x);
Output for git.master, git.master_jit, rfc.property-hooks
Deprecated: Creation of dynamic property Foo::$stuff is deprecated in /in/fCs2s on line 5 O:3:"Foo":1:{s:5:"stuff";a:1:{i:0;i:42;}} object(Foo)#1 (1) { ["stuff"]=> array(1) { [0]=> int(42) } } O:3:"Bar":1:{s:10:"Barstuff";a:1:{i:0;i:42;}} object(Bar)#2 (1) { ["stuff":"Bar":private]=> array(1) { [0]=> int(42) } }

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