3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A{ protected $stuff; function __construct($foo){ if(!is_float($foo)) throw new TypeError("Not a float."); $this->stuff = $foo; } static function __set_state($data){ return new A($data['stuff']); } } $x = new A(0.0); eval(var_export($x, true) . ';');

preferences:
108.64 ms | 2645 KiB | 6 Q