3v4l.org

run code in 200+ PHP versions simultaneously
<?php class A { public $x; public function __construct() { $this->x = 1; } public function __sleep() { return [ 'x', '' ]; } } $a = new A; var_dump( unserialize( serialize( $a ) ) );
based on 1PYc9
Output for 5.6.38 - 7.4.0
Notice: serialize(): "" returned as member variable from __sleep() but does not exist in /in/9KgXc on line 17 object(A)#2 (2) { ["x"]=> int(1) [""]=> NULL }