3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $dt = new DateTime(); $dstr = $dt->format('Y-m-d H:i:s.u'); echo $dstr . "\n"; $dn = DateTime::createFromFormat('Y-m-d H:i:s.u', $dstr); echo $dn->format('U.u') . "\n";
Output for 7.1.0
2013-10-08 12:18:59.005459 1381227539.005459
Output for 5.3.1 - 7.0.14
2013-10-08 12:18:59.000000 1381227539.000000
Output for 5.3.0
2013-10-08 12:18:59.000000 Fatal error: Call to a member function format() on a non-object in /in/v9u3g on line 6
Process exited with code 255.
Output for 5.2.10 - 5.2.17
2013-10-08 12:18:59.000000 Fatal error: Call to undefined method DateTime::createFromFormat() in /in/v9u3g on line 5
Process exited with code 255.
Output for 5.2.2 - 5.2.9
2013-10-08 12:18:59.000000 Fatal error: Call to undefined method DateTime::createfromformat() in /in/v9u3g on line 5
Process exited with code 255.
Output for 5.2.0 - 5.2.1
2013-10-08 12:18:59.u Fatal error: Call to undefined method DateTime::createfromformat() in /in/v9u3g on line 5
Process exited with code 255.
Output for 5.0.0 - 5.1.6
Fatal error: Class 'DateTime' not found in /in/v9u3g 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/v9u3g 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/v9u3g on line 2