3v4l.org

run code in 300+ PHP versions simultaneously
<?php class foo1 { public $a; public function __construct($a) { $this->a = $a; }} class foo2 { protected $a; public function __construct($a) { $this->a = $a; }} class foo3 { private $a; public function __construct($a) { $this->a = $a; }} $foo1 = new foo1("test"); $foo2 = new foo2("test"); $foo3 = new foo3("test"); var_dump(serialize($foo1)); var_dump(serialize($foo2)); var_dump(serialize($foo3)); var_dump(unserialize('O:4:"foo1":1:{s:1:"a";s:4:"test";}')); var_dump(unserialize('O:4:"foo2":1:{s:1:"a";s:4:"test";}')); var_dump(unserialize('O:4:"foo3":1:{s:1:"a";s:4:"test";}'));
Output for git.master, git.master_jit, rfc.property-hooks
string(34) "O:4:"foo1":1:{s:1:"a";s:4:"test";}" string(37) "O:4:"foo2":1:{s:4:"*a";s:4:"test";}" string(40) "O:4:"foo3":1:{s:7:"foo3a";s:4:"test";}" object(foo1)#4 (1) { ["a"]=> string(4) "test" } object(foo2)#4 (1) { ["a":protected]=> string(4) "test" } object(foo3)#4 (1) { ["a":"foo3":private]=> string(4) "test" }

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