3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { private $a; private $b; public function __construct($a) { $this->a = $a; $this->b = $a; } public function __sleep() { return array('a', 'b'); } public function __wakeUp() { $this->__construct($this->a); } public function getA() { return $this->a; } public function getB() { return $this->b; } } class B implements \Serializable { private $a; private $b; public function __construct($a) { $this->a = $a; $this->b = $a; } public function serialize() { return serialize(array($this->a, $this->b)); } public function unserialize($serialized) { list($this->a, $this->b) = unserialize($serialized); $this->__construct($this->a); } public function getA() { return $this->a; } public function getB() { return $this->b; } } class C { private $a; private $b; public function __construct($a) { $this->a = $a; $this->b = $a; } public function getA() { return $this->a; } public function getB() { return $this->b; } } class D extends \ReflectionClass { public function __sleep() { return array('name'); } public function __wakeUp() { $this->__construct($this->name); } } $a = new A('a'); $b = new B('b'); $c = new C('c'); $d = new D('stdClass'); $e = new \ReflectionClass('stdClass'); $serializedA = serialize($a); $serializedB = serialize($b); $serializedC = serialize($c); $serializedD = serialize($d); $serializedE = serialize($e); var_dump($serializedA); var_dump($serializedB); var_dump($serializedC); var_dump($serializedD); var_dump($serializedE); $d = unserialize($serializedD); $d->getMethods(); $d->getProperties();
Output for git.master, git.master_jit, rfc.property-hooks
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/VOIsm on line 35 Fatal error: Uncaught Exception: Serialization of 'D' is not allowed in /in/VOIsm:113 Stack trace: #0 /in/VOIsm(113): serialize(Object(D)) #1 {main} thrown in /in/VOIsm on line 113
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:
35.44 ms | 401 KiB | 8 Q