3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class Entity { private $a; private $b; private $c; private $d; public $e; public function __construct($a = 1, $b = 2, $c = 3) { } } echo serialize(new Entity()); echo PHP_EOL; $createInstance = ':O:1:"Entity":{}'; $obj = unserialize($createInstance); var_dump($obj);
based on YYjPR
Output for 5.6.0 - 5.6.30, 7.1.0 - 7.3.0beta1
O:6:"Entity":5:{s:9:"Entitya";N;s:9:"Entityb";N;s:9:"Entityc";N;s:9:"Entityd";N;s:1:"e";N;} Notice: unserialize(): Error at offset 0 of 16 bytes in /in/CmOBq on line 22 bool(false)
Output for hhvm-3.22.0
O:6:"Entity":5:{s:9:"Entitya";N;s:9:"Entityb";N;s:9:"Entityc";N;s:9:"Entityd";N;s:1:"e";N;} Notice: Unable to unserialize: [:O:1:"Entity":{}]. Expected ':' but got 'O'. in /in/CmOBq on line -1 bool(false)
Output for hhvm-3.18.5 - 3.21.3
O:6:"Entity":5:{s:9:"Entitya";N;s:9:"Entityb";N;s:9:"Entityc";N;s:9:"Entityd";N;s:1:"e";N;} Notice: Unable to unserialize: [:O:1:"Entity":{}]. Expected ':' but got 'O'. in /in/CmOBq on line 22 bool(false)