3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $a = new DateTime('2010-01-01 08:45:00', new DateTimeZone('UTC')); $str = $a->format(DateTime::ISO8601); $b = new DateTime($str, new DateTimeZone('UTC')); echo "\n"; echo "a->timezone_type: " . $a->timezone_type . "\n"; echo "b->timezone_type: " . $b->timezone_type . "\n"; echo "\na: " . print_r($a, true) . "\n"; echo "\nstr: $str\n"; echo "b: " . print_r($b, true) . "\n"; echo "a->timezone_type: " . $a->timezone_type . "\n"; echo "b->timezone_type: " . $b->timezone_type . "\n"; $eq = ($a == $b); echo "\na == b: $eq\n";
Output for 5.4.30 - 5.4.45, 5.5.14 - 7.2.0
Notice: Undefined property: DateTime::$timezone_type in /in/NgXlF on line 7 a->timezone_type: Notice: Undefined property: DateTime::$timezone_type in /in/NgXlF on line 8 b->timezone_type: a: DateTime Object ( [date] => 2010-01-01 08:45:00.000000 [timezone_type] => 3 [timezone] => UTC ) str: 2010-01-01T08:45:00+0000 b: DateTime Object ( [date] => 2010-01-01 08:45:00.000000 [timezone_type] => 1 [timezone] => +00:00 ) a->timezone_type: 3 b->timezone_type: 1 a == b: 1
Output for 5.3.0 - 5.4.29, 5.5.0 - 5.5.13
Notice: Undefined property: DateTime::$timezone_type in /in/NgXlF on line 7 a->timezone_type: Notice: Undefined property: DateTime::$timezone_type in /in/NgXlF on line 8 b->timezone_type: a: DateTime Object ( [date] => 2010-01-01 08:45:00 [timezone_type] => 3 [timezone] => UTC ) str: 2010-01-01T08:45:00+0000 b: DateTime Object ( [date] => 2010-01-01 08:45:00 [timezone_type] => 1 [timezone] => +00:00 ) a->timezone_type: 3 b->timezone_type: 1 a == b: 1
Output for 5.2.6 - 5.2.17
Notice: Undefined property: DateTime::$timezone_type in /in/NgXlF on line 7 a->timezone_type: Notice: Undefined property: DateTime::$timezone_type in /in/NgXlF on line 8 b->timezone_type: a: DateTime Object ( ) str: 2010-01-01T08:45:00+0000 b: DateTime Object ( ) Notice: Undefined property: DateTime::$timezone_type in /in/NgXlF on line 14 a->timezone_type: Notice: Undefined property: DateTime::$timezone_type in /in/NgXlF on line 15 b->timezone_type: a == b: 1
Output for 5.2.0 - 5.2.5
Notice: Undefined property: DateTime::$timezone_type in /in/NgXlF on line 7 a->timezone_type: Notice: Undefined property: DateTime::$timezone_type in /in/NgXlF on line 8 b->timezone_type: a: DateTime Object ( ) str: 2010-01-01T08:45:00+0000 b: DateTime Object ( ) Notice: Undefined property: DateTime::$timezone_type in /in/NgXlF on line 14 a->timezone_type: Notice: Undefined property: DateTime::$timezone_type in /in/NgXlF on line 15 b->timezone_type: a == b: 1
Output for 5.0.0 - 5.1.6
Fatal error: Class 'DateTime' not found in /in/NgXlF on line 2
Process exited with code 255.
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected ')', expecting '(' in /in/NgXlF on line 3
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1
Parse error: parse error, unexpected ')', expecting '(' in /in/NgXlF on line 3
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error, expecting `'('' in /in/NgXlF on line 3
Process exited with code 255.