3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class Foo { public $bar = '120'; public function __sleep() { return [$this->bar, 240]; } } $obj = new Foo(); echo serialize($obj);
based on UppOF
Output for 7.0.6 - 7.2.0
Notice: serialize(): __sleep should return an array only containing the names of instance-variables to serialize. in /in/NaTIv on line 14 Notice: serialize(): "120" returned as member variable from __sleep() but does not exist in /in/NaTIv on line 14 Notice: serialize(): "240" returned as member variable from __sleep() but does not exist in /in/NaTIv on line 14 O:3:"Foo":2:{s:3:"120";N;s:3:"240";N;}
Output for 7.0.0 - 7.0.5
Notice: serialize(): "120" returned as member variable from __sleep() but does not exist in /in/NaTIv on line 14 Notice: serialize(): __sleep should return an array only containing the names of instance-variables to serialize. in /in/NaTIv on line 14 Notice: serialize(): "240" returned as member variable from __sleep() but does not exist in /in/NaTIv on line 14 O:3:"Foo":2:{s:3:"120";N;s:3:"240";N;}
Output for 5.6.8 - 5.6.28
Notice: serialize(): "120" returned as member variable from __sleep() but does not exist in /in/NaTIv on line 14 Notice: serialize(): __sleep should return an array only containing the names of instance-variables to serialize. in /in/NaTIv on line 14 Notice: serialize(): "240" returned as member variable from __sleep() but does not exist in /in/NaTIv on line 14 O:3:"Foo":2:{s:3:"120";N;s:3:"240";R:2;}
Output for 5.4.9 - 5.5.35
Notice: serialize(): "120" returned as member variable from __sleep() but does not exist in /in/NaTIv on line 14 Notice: serialize(): __sleep should return an array only containing the names of instance-variables to serialize. in /in/NaTIv on line 14 O:3:"Foo":2:{s:3:"120";N;N;}
Output for 5.3.19 - 5.3.29
Parse error: syntax error, unexpected '[' in /in/NaTIv on line 9
Process exited with code 255.