3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php class Client { const SOLR_TIMEZONE = 'UTC'; 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(DateTime::createFromFormat('U', 1399440934));
Output for 5.3.0 - 7.1.0
2014-05-07T5:35:34Z
Output for 5.2.10 - 5.2.17
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/uVdW5 on line 8 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/uVdW5 on line 11 Fatal error: Call to undefined method DateTime::createFromFormat() in /in/uVdW5 on line 17
Process exited with code 255.
Output for 5.2.0 - 5.2.9
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/uVdW5 on line 8 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/uVdW5 on line 11 Fatal error: Call to undefined method DateTime::createfromformat() in /in/uVdW5 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/uVdW5 on line 8 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/uVdW5 on line 11 Fatal error: Class 'DateTime' not found in /in/uVdW5 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/uVdW5 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/uVdW5 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/uVdW5 on line 5
Process exited with code 255.