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";}'));

preferences:
62.95 ms | 406 KiB | 5 Q