3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $start = new DateTime('yesterday'); if (is_callable(array($start, '__sleep'))) { echo "Called: __sleep()".PHP_EOL; var_dump($start->__sleep()); echo PHP_EOL.PHP_EOL.PHP_EOL; } $serialized = array( 'class' => get_class($start), 'state' => (array) $start ); echo "Serialized Data:".PHP_EOL; var_dump($serialized); echo PHP_EOL.PHP_EOL.PHP_EOL; unset($start); if (is_callable(array($serialized['class'], '__set_state'))) { echo "Called: __set_state()".PHP_EOL; var_dump($serialized['class']::__set_state($serialized['state'])); echo PHP_EOL.PHP_EOL.PHP_EOL; } if (is_callable(array($serialized['class'], '__wake'))) { echo "Called: __wake()".PHP_EOL; var_dump($serialized['class']::__wake()); echo PHP_EOL.PHP_EOL.PHP_EOL; }
based on gotk9
Output for 5.4.30 - 5.4.45, 5.6.28, 7.0.20 - 7.2.0
Serialized Data: array(2) { ["class"]=> string(8) "DateTime" ["state"]=> array(3) { ["date"]=> string(26) "2016-01-05 00:00:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } } Called: __set_state() object(DateTime)#1 (3) { ["date"]=> string(26) "2016-01-05 00:00:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 7.0.6
Serialized Data: array(2) { ["class"]=> string(8) "DateTime" ["state"]=> array(3) { ["date"]=> string(26) "2016-05-20 00:00:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } } Called: __set_state() object(DateTime)#1 (3) { ["date"]=> string(26) "2016-05-20 00:00:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 7.0.5
Serialized Data: array(2) { ["class"]=> string(8) "DateTime" ["state"]=> array(3) { ["date"]=> string(26) "2016-04-02 00:00:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } } Called: __set_state() object(DateTime)#1 (3) { ["date"]=> string(26) "2016-04-02 00:00:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 7.0.4
Serialized Data: array(2) { ["class"]=> string(8) "DateTime" ["state"]=> array(3) { ["date"]=> string(26) "2016-03-09 00:00:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } } Called: __set_state() object(DateTime)#1 (3) { ["date"]=> string(26) "2016-03-09 00:00:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 7.0.3
Serialized Data: array(2) { ["class"]=> string(8) "DateTime" ["state"]=> array(3) { ["date"]=> string(26) "2016-03-17 00:00:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } } Called: __set_state() object(DateTime)#1 (3) { ["date"]=> string(26) "2016-03-17 00:00:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 7.0.2
Serialized Data: array(2) { ["class"]=> string(8) "DateTime" ["state"]=> array(3) { ["date"]=> string(26) "2016-03-22 00:00:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } } Called: __set_state() object(DateTime)#1 (3) { ["date"]=> string(26) "2016-03-22 00:00:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 7.0.1
Serialized Data: array(2) { ["class"]=> string(8) "DateTime" ["state"]=> array(3) { ["date"]=> string(26) "2016-03-23 00:00:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } } Called: __set_state() object(DateTime)#1 (3) { ["date"]=> string(26) "2016-03-23 00:00:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 7.0.0
Serialized Data: array(2) { ["class"]=> string(8) "DateTime" ["state"]=> array(3) { ["date"]=> string(26) "2016-03-26 00:00:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } } Called: __set_state() object(DateTime)#1 (3) { ["date"]=> string(26) "2016-03-26 00:00:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.6.21
Serialized Data: array(2) { ["class"]=> string(8) "DateTime" ["state"]=> array(3) { ["date"]=> string(26) "2016-05-01 00:00:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } } Called: __set_state() object(DateTime)#1 (3) { ["date"]=> string(26) "2016-05-01 00:00:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.6.20
Serialized Data: array(2) { ["class"]=> string(8) "DateTime" ["state"]=> array(3) { ["date"]=> string(26) "2016-04-09 00:00:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } } Called: __set_state() object(DateTime)#1 (3) { ["date"]=> string(26) "2016-04-09 00:00:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.6.19
Serialized Data: array(2) { ["class"]=> string(8) "DateTime" ["state"]=> array(3) { ["date"]=> string(26) "2016-03-07 00:00:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } } Called: __set_state() object(DateTime)#1 (3) { ["date"]=> string(26) "2016-03-07 00:00:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.6.18
Serialized Data: array(2) { ["class"]=> string(8) "DateTime" ["state"]=> array(3) { ["date"]=> string(26) "2016-03-14 00:00:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } } Called: __set_state() object(DateTime)#1 (3) { ["date"]=> string(26) "2016-03-14 00:00:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.6.17
Serialized Data: array(2) { ["class"]=> string(8) "DateTime" ["state"]=> array(3) { ["date"]=> string(26) "2016-03-19 00:00:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } } Called: __set_state() object(DateTime)#1 (3) { ["date"]=> string(26) "2016-03-19 00:00:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.6.16
Serialized Data: array(2) { ["class"]=> string(8) "DateTime" ["state"]=> array(3) { ["date"]=> string(26) "2016-03-27 00:00:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } } Called: __set_state() object(DateTime)#1 (3) { ["date"]=> string(26) "2016-03-27 00:00:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.6.15
Serialized Data: array(2) { ["class"]=> string(8) "DateTime" ["state"]=> array(3) { ["date"]=> string(26) "2016-03-28 00:00:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } } Called: __set_state() object(DateTime)#1 (3) { ["date"]=> string(26) "2016-03-28 00:00:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.6.14
Serialized Data: array(2) { ["class"]=> string(8) "DateTime" ["state"]=> array(3) { ["date"]=> string(26) "2016-04-13 00:00:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } } Called: __set_state() object(DateTime)#1 (3) { ["date"]=> string(26) "2016-04-13 00:00:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.6.13
Serialized Data: array(2) { ["class"]=> string(8) "DateTime" ["state"]=> array(3) { ["date"]=> string(26) "2016-04-14 00:00:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } } Called: __set_state() object(DateTime)#1 (3) { ["date"]=> string(26) "2016-04-14 00:00:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.6.12
Serialized Data: array(2) { ["class"]=> string(8) "DateTime" ["state"]=> array(3) { ["date"]=> string(26) "2016-04-19 00:00:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } } Called: __set_state() object(DateTime)#1 (3) { ["date"]=> string(26) "2016-04-19 00:00:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.6.11
Serialized Data: array(2) { ["class"]=> string(8) "DateTime" ["state"]=> array(3) { ["date"]=> string(26) "2016-04-23 00:00:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } } Called: __set_state() object(DateTime)#1 (3) { ["date"]=> string(26) "2016-04-23 00:00:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.6.10
Serialized Data: array(2) { ["class"]=> string(8) "DateTime" ["state"]=> array(3) { ["date"]=> string(26) "2016-04-24 00:00:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } } Called: __set_state() object(DateTime)#1 (3) { ["date"]=> string(26) "2016-04-24 00:00:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.6.9
Serialized Data: array(2) { ["class"]=> string(8) "DateTime" ["state"]=> array(3) { ["date"]=> string(26) "2016-04-26 00:00:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } } Called: __set_state() object(DateTime)#1 (3) { ["date"]=> string(26) "2016-04-26 00:00:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.6.8
Serialized Data: array(2) { ["class"]=> string(8) "DateTime" ["state"]=> array(3) { ["date"]=> string(26) "2016-04-29 00:00:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } } Called: __set_state() object(DateTime)#1 (3) { ["date"]=> string(26) "2016-04-29 00:00:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.5.35
Serialized Data: array(2) { ["class"]=> string(8) "DateTime" ["state"]=> array(3) { ["date"]=> string(26) "2016-05-22 00:00:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } } Called: __set_state() object(DateTime)#1 (3) { ["date"]=> string(26) "2016-05-22 00:00:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.5.34
Serialized Data: array(2) { ["class"]=> string(8) "DateTime" ["state"]=> array(3) { ["date"]=> string(26) "2016-04-10 00:00:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } } Called: __set_state() object(DateTime)#1 (3) { ["date"]=> string(26) "2016-04-10 00:00:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.5.33
Serialized Data: array(2) { ["class"]=> string(8) "DateTime" ["state"]=> array(3) { ["date"]=> string(26) "2016-03-08 00:00:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } } Called: __set_state() object(DateTime)#1 (3) { ["date"]=> string(26) "2016-03-08 00:00:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.5.32
Serialized Data: array(2) { ["class"]=> string(8) "DateTime" ["state"]=> array(3) { ["date"]=> string(26) "2016-03-16 00:00:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } } Called: __set_state() object(DateTime)#1 (3) { ["date"]=> string(26) "2016-03-16 00:00:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.5.31
Serialized Data: array(2) { ["class"]=> string(8) "DateTime" ["state"]=> array(3) { ["date"]=> string(26) "2016-03-20 00:00:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } } Called: __set_state() object(DateTime)#1 (3) { ["date"]=> string(26) "2016-03-20 00:00:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.5.30
Serialized Data: array(2) { ["class"]=> string(8) "DateTime" ["state"]=> array(3) { ["date"]=> string(26) "2016-03-31 00:00:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } } Called: __set_state() object(DateTime)#1 (3) { ["date"]=> string(26) "2016-03-31 00:00:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.5.29
Serialized Data: array(2) { ["class"]=> string(8) "DateTime" ["state"]=> array(3) { ["date"]=> string(26) "2016-04-16 00:00:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } } Called: __set_state() object(DateTime)#1 (3) { ["date"]=> string(26) "2016-04-16 00:00:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.5.28
Serialized Data: array(2) { ["class"]=> string(8) "DateTime" ["state"]=> array(3) { ["date"]=> string(26) "2016-04-20 00:00:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } } Called: __set_state() object(DateTime)#1 (3) { ["date"]=> string(26) "2016-04-20 00:00:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.5.27
Serialized Data: array(2) { ["class"]=> string(8) "DateTime" ["state"]=> array(3) { ["date"]=> string(26) "2016-04-21 00:00:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } } Called: __set_state() object(DateTime)#1 (3) { ["date"]=> string(26) "2016-04-21 00:00:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.5.26
Serialized Data: array(2) { ["class"]=> string(8) "DateTime" ["state"]=> array(3) { ["date"]=> string(26) "2016-04-25 00:00:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } } Called: __set_state() object(DateTime)#1 (3) { ["date"]=> string(26) "2016-04-25 00:00:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.5.25
Serialized Data: array(2) { ["class"]=> string(8) "DateTime" ["state"]=> array(3) { ["date"]=> string(26) "2016-04-28 00:00:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } } Called: __set_state() object(DateTime)#1 (3) { ["date"]=> string(26) "2016-04-28 00:00:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.5.24
Serialized Data: array(2) { ["class"]=> string(8) "DateTime" ["state"]=> array(3) { ["date"]=> string(26) "2016-05-23 00:00:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } } Called: __set_state() object(DateTime)#1 (3) { ["date"]=> string(26) "2016-05-23 00:00:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.3.21 - 5.4.29
Serialized Data: array(2) { ["class"]=> string(8) "DateTime" ["state"]=> array(3) { ["date"]=> string(19) "2016-01-05 00:00:00" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } } Called: __set_state() object(DateTime)#1 (3) { ["date"]=> string(19) "2016-01-05 00:00:00" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }