3v4l.org

run code in 300+ PHP versions simultaneously
<?php class foo { public $throw_exception = false; function __sleep() { } function __construct() { echo "construct called\n"; if ($this->throw_exception == true) { throw new Exception(); } else { $this->throw->exception=true; } } } $a = new foo; $x = serialize($a); $y = unserialize($a);

preferences:
45.51 ms | 402 KiB | 5 Q