3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php class A { private $a; private $b; public function __construct($a) { $this->a = $a; $this->b = $a; } public function __sleep() { 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(); $serialized = serialize($a); $unserialized = unserialize($serialized); var_dump($serialized); var_dump($unserialized); var_dump($unserialized->getA()); var_dump($unserialized->getB());
Output for 7.1.0
Fatal error: Uncaught ArgumentCountError: Too few arguments to function A::__construct(), 0 passed in /in/cfjta on line 35 and exactly 1 expected in /in/cfjta:8 Stack trace: #0 /in/cfjta(35): A->__construct() #1 {main} thrown in /in/cfjta on line 8
Process exited with code 255.
Output for 5.5.0 - 5.6.28, 7.0.0 - 7.0.14
Warning: Missing argument 1 for A::__construct(), called in /in/cfjta on line 35 and defined in /in/cfjta on line 8 Notice: Undefined variable: a in /in/cfjta on line 10 Notice: Undefined variable: a in /in/cfjta on line 11 string(25) "O:1:"A":1:{s:4:"Aa";N;}" object(A)#2 (2) { ["a":"A":private]=> NULL ["b":"A":private]=> NULL } NULL NULL
Output for hhvm-3.10.0 - 3.12.0
Warning: __construct() expects exactly 1 parameter, 0 given in /in/cfjta on line 10 Notice: Undefined variable: a in /in/cfjta on line 10 Notice: Undefined variable: a in /in/cfjta on line 11 string(25) "O:1:"A":1:{s:4:"Aa";N;}" object(A)#2 (2) { ["a":"A":private]=> NULL ["b":"A":private]=> NULL } NULL NULL
Output for 5.3.0 - 5.4.45
Warning: Missing argument 1 for A::__construct(), called in /in/cfjta on line 35 and defined in /in/cfjta on line 8 string(25) "O:1:"A":1:{s:4:"Aa";N;}" object(A)#2 (2) { ["a":"A":private]=> NULL ["b":"A":private]=> NULL } NULL NULL
Output for 5.2.3 - 5.2.17
Warning: Missing argument 1 for A::__construct(), called in /in/cfjta on line 35 and defined in /in/cfjta on line 8 string(25) "O:1:"A":1:{s:4:"Aa";N;}" object(A)#2 (2) { ["a:private"]=> NULL ["b:private"]=> NULL } NULL NULL
Output for 5.1.0 - 5.2.2
<br /> <b>Warning</b>: Missing argument 1 for A::__construct(), called in /in/cfjta on line 35 and defined in <b>/in/cfjta</b> on line <b>8</b><br /> string(25) "O:1:"A":1:{s:4:"Aa";N;}" object(A)#2 (2) { ["a:private"]=> NULL ["b:private"]=> NULL } NULL NULL
Output for 5.0.5
<br /> <b>Warning</b>: Missing argument 1 for A::__construct() in <b>/in/cfjta</b> on line <b>8</b><br />
Process exited with code 139.
Output for 5.0.2 - 5.0.4
<br /> <b>Warning</b>: Missing argument 1 for A::__construct() in <b>/in/cfjta</b> on line <b>8</b><br /> string(25) "O:1:"A":1:{s:4:"Aa";N;}" object(A)#2 (2) { ["a:private"]=> NULL ["b:private"]=> NULL } NULL NULL
Output for 5.0.0 - 5.0.1
<br /> <b>Warning</b>: Missing argument 1 for A::__construct() in <b>/in/cfjta</b> on line <b>8</b><br /> string(22) "O:1:"A":1:{s:1:"a";N;}" object(A)#2 (3) { ["a:private"]=> NULL ["b:private"]=> NULL ["a"]=> NULL } NULL NULL
Output for 4.4.2 - 4.4.9
<br /> <b>Parse error</b>: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in <b>/in/cfjta</b> on line <b>5</b><br />
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1
<br /> <b>Parse error</b>: parse error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in <b>/in/cfjta</b> on line <b>5</b><br />
Process exited with code 255.
Output for 4.3.2 - 4.3.4
<br /> <b>Parse error</b>: parse error, expecting `T_OLD_FUNCTION' or `T_FUNCTION' or `T_VAR' or `'}'' in <b>/in/cfjta</b> on line <b>5</b><br />
Process exited with code 255.