3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A extends \ReflectionClass implements \Serializable { public function serialize() { return serialize($this->name); } public function unserialize($serialized) { //$this->__construct(unserialize($serialized)); $this->name = unserialize($serialized); } } $a = new A('ReflectionClass'); $serialized = serialize($a); var_dump($serialized); $unserialized = unserialize($serialized); var_dump($unserialized == $a); var_dump($unserialized === $a); var_dump($unserialized->getConstants());
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/kjL4u on line 3 Fatal error: Uncaught Exception: Serialization of 'A' is not allowed in /in/kjL4u:19 Stack trace: #0 /in/kjL4u(19): serialize(Object(A)) #1 {main} thrown in /in/kjL4u on line 19
Process exited with code 255.

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:
38.14 ms | 401 KiB | 8 Q