3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A implements \Serializable { public function serialize() { $s = new \stdClass(); $s->id = 1; var_dump($s); return serialize($s); } public function unserialize($s) { } } class B extends A { public function serialize() { $p = parent::serialize(); $s = unserialize($p); $s->foo = 'bar'; $s2 = serialize($s); var_dump($p, $s, $s2); // $s2 = 'r:2' //var_dump(unserialize($s2)); // will throw error as can't unserialize die; //return serialize($s); } } $b = new B; serialize($b);
Output for git.master, git.master_jit, rfc.property-hooks
Deprecated: A implements the Serializable interface, which is deprecated. Implement __serialize() and __unserialize() instead (or in addition, if support for old PHP versions is necessary) in /in/fuI8h on line 2 Deprecated: B implements the Serializable interface, which is deprecated. Implement __serialize() and __unserialize() instead (or in addition, if support for old PHP versions is necessary) in /in/fuI8h on line 16 object(stdClass)#2 (1) { ["id"]=> int(1) } string(32) "O:8:"stdClass":1:{s:2:"id";i:1;}" object(stdClass)#3 (2) { ["id"]=> int(1) ["foo"]=> string(3) "bar" } string(52) "O:8:"stdClass":2:{s:2:"id";i:1;s:3:"foo";s:3:"bar";}"

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:
40.35 ms | 403 KiB | 8 Q