3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php class Client { const SOLR_TIMEZONE = 'Zulu'; const SOLR_DATEFORMAT = 'Y-m-d\TG:i:s\Z'; public static function formatToSolrFormat(\DateTime $date) { $date = clone $date; $date->setTimezone(new \DateTimeZone(self::SOLR_TIMEZONE)); return $date->format(self::SOLR_DATEFORMAT); } } echo Client::formatToSolrFormat(new \DateTime('P1399440934'));
Output for 7.0.0 - 7.1.0
Fatal error: Uncaught Exception: DateTime::__construct(): Failed to parse time string (P1399440934) at position 9 (3): Unexpected character in /in/OeO7V:17 Stack trace: #0 /in/OeO7V(17): DateTime->__construct('P1399440934') #1 {main} thrown in /in/OeO7V on line 17
Process exited with code 255.
Output for hhvm-3.10.0 - 3.12.0
Fatal error: Uncaught exception 'Exception' with message 'DateTime::__construct(): Failed to parse time string (P1399440934) at position 9 (3): Unexpected character' in /in/OeO7V:17 Stack trace: #0 /in/OeO7V(17): DateTime->__construct() #1 {main}
Process exited with code 255.
Output for 5.3.0 - 5.6.28
Fatal error: Uncaught exception 'Exception' with message 'DateTime::__construct(): Failed to parse time string (P1399440934) at position 9 (3): Unexpected character' in /in/OeO7V:17 Stack trace: #0 /in/OeO7V(17): DateTime->__construct('P1399440934') #1 {main} thrown in /in/OeO7V on line 17
Process exited with code 255.
Output for 5.2.0 - 5.2.17
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/OeO7V on line 8 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/OeO7V on line 11 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/OeO7V on line 17 Fatal error: Uncaught exception 'Exception' with message 'DateTime::__construct(): Failed to parse time string (P1399440934) at position 9 (3): Unexpected character' in /in/OeO7V:17 Stack trace: #0 /in/OeO7V(17): DateTime->__construct('P1399440934') #1 {main} thrown in /in/OeO7V on line 17
Process exited with code 255.
Output for 5.0.0 - 5.1.6
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/OeO7V on line 8 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/OeO7V on line 11 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/OeO7V on line 17 Fatal error: Class 'DateTime' not found in /in/OeO7V on line 17
Process exited with code 255.
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected T_CONST, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/OeO7V on line 5
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_CONST, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/OeO7V on line 5
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error, expecting `T_OLD_FUNCTION' or `T_FUNCTION' or `T_VAR' or `'}'' in /in/OeO7V on line 5
Process exited with code 255.