3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php // 簡単なクラスを宣言 class TestClass { public $foo; private $debug = false; public function __construct($foo) { $this->foo = $foo; } public function myDo() { return $this->debug; } public function __destruct() { if($this->debug) { echo "YES!!"; } } } $class = new TestClass('Hello'); //$ser = serialize($class); $ser = serialize("O:9:&quot;TestClass&quot;:2:{s:14:&quot;TestClassfoo&quot;;s:5:&quot;Hello&quot;;s:16:&quot;TestClassdebug&quot;;b:0;}"); $deser = unserialize($ser); if ($deser === FALSE) { echo "error."; } echo $class->foo; print ((true === $class->myDo()) ? 'true' : 'false' ). PHP_EOL; //echo $class->debug; //echo htmlspecialchars(serialize($deser)); ?>
based on EB2dO
Output for 5.6.0 - 5.6.30, hhvm-3.18.5 - 3.22.0, 7.0.0 - 7.3.0beta1
Hellofalse