3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class Foo { private $data = array("Foo"); public function __sleep() { return array("data"); } } class Bar implements Serializable{ private $data = array("Bar"); public function serialize() { return serialize($this->data); } public function unserialize($data) { $this->data = unserialize($data); } public function __sleep() { echo "this won't get called"; exit; } } $foo = new Foo; $bar = new Bar; var_dump(serialize($foo)); var_dump(serialize($bar));

Shows result from various feature-branches currently under review from the php developers. Contact me to have additional branches featured.

Output for Typed properties v2
string(50) "O:3:"Foo":1:{s:9:"Foodata";a:1:{i:0;s:3:"Foo";}}" string(35) "C:3:"Bar":20:{a:1:{i:0;s:3:"Bar";}}"
Output for Array change keys
string(50) "O:3:"Foo":1:{s:9:"Foodata";a:1:{i:0;s:3:"Foo";}}" string(35) "C:3:"Bar":20:{a:1:{i:0;s:3:"Bar";}}"
Output for Lexical anon
string(50) "O:3:"Foo":1:{s:9:"Foodata";a:1:{i:0;s:3:"Foo";}}" string(35) "C:3:"Bar":20:{a:1:{i:0;s:3:"Bar";}}"

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