3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $str = "Tue, 10 Apr 2012 11:27:56 +0300"; $d1 = new DateTime($str); $d2 = new DateTime; $d2->modify($str); $t1 = $d1->getTimestamp(); $t2 = $d2->getTimestamp(); $tz1 = $d1->getTimezone()->getName(); $tz2 = $d2->getTimezone()->getName(); $f1 = $d1->format(DateTime::RFC2822); $f2 = $d2->format(DateTime::RFC2822); var_dump(compact('t1', 't2', 'tz1', 'tz2', 'f1', 'f2'));
Output for 5.3.6 - 5.6.28, 7.0.0 - 7.1.0
array(6) { ["t1"]=> int(1334046476) ["t2"]=> int(1334050076) ["tz1"]=> string(6) "+03:00" ["tz2"]=> string(16) "Europe/Amsterdam" ["f1"]=> string(31) "Tue, 10 Apr 2012 11:27:56 +0300" ["f2"]=> string(31) "Tue, 10 Apr 2012 11:27:56 +0200" }
Output for hhvm-3.10.0 - 3.12.0
array(6) { ["t1"]=> int(1334046476) ["t2"]=> int(1334050076) ["tz1"]=> string(16) "Europe/Amsterdam" ["tz2"]=> string(16) "Europe/Amsterdam" ["f1"]=> string(31) "Tue, 10 Apr 2012 11:27:56 +0300" ["f2"]=> string(31) "Tue, 10 Apr 2012 11:27:56 +0200" }
Output for 5.3.0 - 5.3.5
array(6) { ["t1"]=> int(1334046476) ["t2"]=> int(1354052843) ["tz1"]=> string(6) "+03:00" ["tz2"]=> string(16) "Europe/Amsterdam" ["f1"]=> string(31) "Tue, 10 Apr 2012 11:27:56 +0300" ["f2"]=> string(31) "Tue, 27 Nov 2012 22:47:23 +0100" }
Output for 5.2.0 - 5.2.17
Fatal error: Call to undefined method DateTime::getTimestamp() in /in/vkVJ1 on line 9
Process exited with code 255.
Output for 5.0.0 - 5.1.6
Fatal error: Class 'DateTime' not found in /in/vkVJ1 on line 5
Process exited with code 255.
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected T_OBJECT_OPERATOR in /in/vkVJ1 on line 11
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1
Parse error: parse error, unexpected T_OBJECT_OPERATOR in /in/vkVJ1 on line 11
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/vkVJ1 on line 11
Process exited with code 255.