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; } } $a = new A('a'); $b = new B('b'); $c = new C('c'); $serializedA = serialize($a); $serializedB = serialize($b); $serializedC = serialize($c); var_dump($serializedA); var_dump($serializedB); var_dump($serializedC);
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/p8Mr9 on line 35 string(50) "O:1:"A":2:{s:4:"Aa";s:1:"a";s:4:"Ab";s:1:"a";}" string(43) "C:1:"B":30:{a:2:{i:0;s:1:"b";i:1;s:1:"b";}}" string(50) "O:1:"C":2:{s:4:"Ca";s:1:"c";s:4:"Cb";s:1:"c";}"

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