3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $date = new DateTime('2015-01-01 18:00:00.123456'); echo $date->format('u'), PHP_EOL; var_dump(json_encode($date));
based on 0J0RH
Output for 5.4.30 - 5.4.45, 5.5.14 - 7.2.0
123456 string(86) "{"date":"2015-01-01 18:00:00.123456","timezone_type":3,"timezone":"Europe\/Amsterdam"}"
Output for 5.3.0 - 5.4.29, 5.5.0 - 5.5.13
123456 string(79) "{"date":"2015-01-01 18:00:00","timezone_type":3,"timezone":"Europe\/Amsterdam"}"
Output for 5.2.2 - 5.2.17
123456 string(2) "{}"
Output for 5.2.0 - 5.2.1
u string(2) "{}"
Output for 5.0.0 - 5.1.6
Fatal error: Class 'DateTime' not found in /in/eaHdc on line 3
Process exited with code 255.
Output for 4.3.2 - 4.4.9
Fatal error: Cannot instantiate non-existent class: datetime in /in/eaHdc on line 3
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Cannot instantiate non-existent class: datetime in /in/eaHdc on line 3