3v4l.org

run code in 300+ PHP versions simultaneously
<?php class SleepyHead { protected $name = "Dozy"; public function __sleep() { $this->name = "Asleep"; } public function __wakeUp() { $this->name = "Rested"; } } $obj = unserialize(serialize(new SleepyHead())); var_dump($obj);
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.27, 8.2.0 - 8.2.17, 8.3.0 - 8.3.4
Warning: serialize(): SleepyHead::__sleep() should return an array only containing the names of instance-variables to serialize in /in/H96m9 on line 14 NULL
Output for 7.1.0 - 7.1.25, 7.2.0 - 7.2.33, 7.3.0 - 7.3.31, 7.4.0 - 7.4.33
Notice: serialize(): __sleep should return an array only containing the names of instance-variables to serialize in /in/H96m9 on line 14 NULL
Output for 7.3.32 - 7.3.33
NULL

preferences:
150.51 ms | 401 KiB | 167 Q