3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class Foo { private $bar; private $baz; public function __construct($bar, $baz) { $this->bar = $bar; $this->baz = $baz; } } $foo = new Foo('hello','word'); $json = json_encode($foo); echo $json; $serialize = serialize($foo); echo $serialize; var_dump( json_decode($json) ); var_dump( deserialize($serialize) );
based on sn8JQ

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
{}O:3:"Foo":2:{s:8:"Foobar";s:5:"hello";s:8:"Foobaz";s:4:"word";}object(stdClass)#2 (0) { } Fatal error: Uncaught Error: Call to undefined function deserialize() in /in/2JcFT:24 Stack trace: #0 {main} thrown in /in/2JcFT on line 24
Output for Array change keys
{}O:3:"Foo":2:{s:8:"Foobar";s:5:"hello";s:8:"Foobaz";s:4:"word";}object(stdClass)#2 (0) { } Fatal error: Uncaught Error: Call to undefined function deserialize() in /in/2JcFT:24 Stack trace: #0 {main} thrown in /in/2JcFT on line 24
Output for Lexical anon
{}O:3:"Foo":2:{s:8:"Foobar";s:5:"hello";s:8:"Foobaz";s:4:"word";}object(stdClass)#2 (0) { } Fatal error: Call to undefined function deserialize() in /in/2JcFT on line 24

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