3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class Test { private $one = 1; private $two = 2; private $three = 3; public function test() {} public function __sleep() { return ['one']; } } $t = new Test; $b = (string) serialize($t); $t = null; echo $b; echo '<pre>'; print_r(unserialize($b)); ?>
based on ZWa8f
Output for 7.0.0 - 7.2.0
Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; Test has a deprecated constructor in /in/X2AHC on line 3 O:4:"Test":1:{s:9:"Testone";i:1;}<pre>Test Object ( [one:Test:private] => 1 [two:Test:private] => 2 [three:Test:private] => 3 )
Output for 5.4.12 - 5.6.21
O:4:"Test":1:{s:9:"Testone";i:1;}<pre>Test Object ( [one:Test:private] => 1 [two:Test:private] => 2 [three:Test:private] => 3 )
Output for 5.3.22 - 5.3.29
Parse error: syntax error, unexpected '[' in /in/X2AHC on line 12
Process exited with code 255.