3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $dateString = '2015-03-21 22:22:00'; $date1 = new \DateTimeImmutable($dateString, new \DateTimeZone('America/Caracas')); echo "Timestamp America/Caracas:\t\t{$date1->getTimestamp()} \n"; $date1->setTimezone(new \DateTimeZone('UTC')); echo "Timestamp UTC (setTimezone):\t\t{$date1->getTimestamp()} \n"; $date2 = new \DateTime($dateString, new \DateTimeZone('UTC')); echo "Timestamp UTC (construct):\t\t{$date2->getTimestamp()} \n";
based on 8VFsk
Output for 5.5.0 - 7.2.0
Timestamp America/Caracas: 1426992720 Timestamp UTC (setTimezone): 1426992720 Timestamp UTC (construct): 1426976520
Output for 5.3.0 - 5.4.45
Fatal error: Class 'DateTimeImmutable' not found in /in/7dB4g on line 5
Process exited with code 255.
Output for 5.0.0 - 5.2.17
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/7dB4g on line 5 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/7dB4g on line 5 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/7dB4g on line 9 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/7dB4g on line 13 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/7dB4g on line 13 Fatal error: Class 'DateTimeImmutable' not found in /in/7dB4g on line 5
Process exited with code 255.
Output for 4.4.2 - 4.4.9
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/7dB4g on line 5 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/7dB4g on line 5 Parse error: syntax error, unexpected '(', expecting '}' in /in/7dB4g on line 7
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/7dB4g on line 5 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/7dB4g on line 5 Parse error: parse error, unexpected '(', expecting '}' in /in/7dB4g on line 7
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/7dB4g on line 5 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/7dB4g on line 5 Parse error: parse error, expecting `'}'' in /in/7dB4g on line 7
Process exited with code 255.