3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $x = new DateTime("A String"); $date_errors = DateTime::getLastErrors(); var_dump($x); var_dump($date_errors);
Output for 7.1.0
object(DateTime)#1 (3) { ["date"]=> string(26) "2013-08-27 10:17:23.006373" ["timezone_type"]=> int(2) ["timezone"]=> string(1) "A" } array(4) { ["warning_count"]=> int(1) ["warnings"]=> array(1) { [2]=> string(29) "Double timezone specification" } ["error_count"]=> int(0) ["errors"]=> array(0) { } }
Output for 5.4.30 - 5.4.45, 5.5.14 - 7.0.14
object(DateTime)#1 (3) { ["date"]=> string(26) "2013-08-27 10:17:23.000000" ["timezone_type"]=> int(2) ["timezone"]=> string(1) "A" } array(4) { ["warning_count"]=> int(1) ["warnings"]=> array(1) { [2]=> string(29) "Double timezone specification" } ["error_count"]=> int(0) ["errors"]=> array(0) { } }
Output for 5.3.0 - 5.4.29, 5.5.0 - 5.5.13
object(DateTime)#1 (3) { ["date"]=> string(19) "2013-08-27 10:17:23" ["timezone_type"]=> int(2) ["timezone"]=> string(1) "A" } array(4) { ["warning_count"]=> int(1) ["warnings"]=> array(1) { [2]=> string(29) "Double timezone specification" } ["error_count"]=> int(0) ["errors"]=> array(0) { } }
Output for 5.2.10 - 5.2.17
Fatal error: Call to undefined method DateTime::getLastErrors() in /in/UqNFm on line 3
Process exited with code 255.
Output for 5.2.0 - 5.2.9
Fatal error: Call to undefined method DateTime::getlasterrors() in /in/UqNFm on line 3
Process exited with code 255.
Output for 5.0.0 - 5.1.6
Fatal error: Class 'DateTime' not found in /in/UqNFm on line 2
Process exited with code 255.
Output for 4.3.2 - 4.4.9
Fatal error: Cannot instantiate non-existent class: datetime in /in/UqNFm on line 2
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Cannot instantiate non-existent class: datetime in /in/UqNFm on line 2