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() { throw new \Exception(); return array('a'); } public function __wakeUp() { //$this->__construct($this->a); } public function getA() { return $this->a; } public function getB() { return $this->b; } } $a = new A('a'); $serialized = serialize($a); $unserialized = unserialize($serialized); var_dump($serialized); var_dump($unserialized); var_dump($unserialized->getA()); var_dump($unserialized->getB());
Output for git.master, git.master_jit, rfc.property-hooks
Fatal error: Uncaught Exception in /in/k5hAS:16 Stack trace: #0 [internal function]: A->__sleep() #1 /in/k5hAS(37): serialize(Object(A)) #2 {main} thrown in /in/k5hAS on line 16
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:
42.84 ms | 401 KiB | 8 Q