3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { private $b = 'foo'; } class B extends A { public function __sleep() { return array('b'); } } class C extends A implements Serializable { public function unserialize($serialized) { /*... */ } public function serialize() { $b = new ReflectionProperty('A', 'b'); $b->setAccessible(true); return serialize(array('b' => $b->getValue($this))); } } var_dump(serialize(new A())); var_dump(serialize(new B())); var_dump(serialize(new C()));
Output for git.master, git.master_jit, rfc.property-hooks
Deprecated: C 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/s23O9 on line 16 string(33) "O:1:"A":1:{s:4:"Ab";s:3:"foo";}" Warning: serialize(): "b" returned as member variable from __sleep() but does not exist in /in/s23O9 on line 28 string(12) "O:1:"B":0:{}" string(37) "C:1:"C":24:{a:1:{s:1:"b";s:3:"foo";}}"

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