3v4l.org

run code in 200+ PHP versions simultaneously
<?php echo "All 3 should show the fractions of second:\n"; echo var_dump((new \DateTime())->format('Y-m-d\TH:i:s.u')); echo var_dump((new \IntlDateFormatter( 'en-US', \IntlDateFormatter::FULL, \IntlDateFormatter::FULL, 'UTC', \IntlDateFormatter::GREGORIAN, 'yyyy-MM-dd HH:mm:ss.SSSSSS' ))->format(new \DateTime())); echo var_dump(datefmt_create( 'en-US', \IntlDateFormatter::FULL, \IntlDateFormatter::FULL, 'UTC', \IntlDateFormatter::GREGORIAN, 'yyyy-MM-dd HH:mm:ss.SSSSSS' )->format(new \DateTime()));
based on rU9VM
Output for 7.4.0
All 3 should show the fractions of second: string(26) "2017-04-17T09:22:03.000186" string(26) "2017-04-17 07:22:03.001000" string(26) "2017-04-17 07:22:03.001000"
Output for 7.2.6
All 3 should show the fractions of second: string(26) "2017-04-17T09:22:03.003286" string(26) "2017-04-17 07:22:03.008000" string(26) "2017-04-17 07:22:03.008000"
Output for 7.2.0
All 3 should show the fractions of second: string(26) "2017-04-17T09:22:03.003625" string(26) "2017-04-17 07:22:03.020000" string(26) "2017-04-17 07:22:03.020000"
Output for 7.1.20
All 3 should show the fractions of second: string(26) "2017-04-17T09:22:03.035743" string(26) "2017-04-17 07:22:03.055000" string(26) "2017-04-17 07:22:03.055000"
Output for 7.1.7
All 3 should show the fractions of second: string(26) "2017-04-17T09:22:03.048383" string(26) "2017-04-17 07:22:03.049000" string(26) "2017-04-17 07:22:03.049000"
Output for 7.1.6
All 3 should show the fractions of second: string(26) "2017-04-17T09:22:03.020298" string(26) "2017-04-17 07:22:03.021000" string(26) "2017-04-17 07:22:03.021000"
Output for 7.1.5
All 3 should show the fractions of second: string(26) "2017-04-17T09:22:03.018369" string(26) "2017-04-17 07:22:03.019000" string(26) "2017-04-17 07:22:03.019000"
Output for 7.1.4
All 3 should show the fractions of second: string(26) "2017-04-17T09:22:03.022722" string(26) "2017-04-17 07:22:03.000000" string(26) "2017-04-17 07:22:03.000000"
Output for 7.0.0 - 7.0.9, 7.0.11 - 7.0.20, 7.1.3
All 3 should show the fractions of second: string(26) "2017-04-17T09:22:03.000000" string(26) "2017-04-17 07:22:03.000000" string(26) "2017-04-17 07:22:03.000000"
Output for 7.1.2
All 3 should show the fractions of second: string(26) "2017-04-17T09:22:03.030134" string(26) "2017-04-17 07:22:03.000000" string(26) "2017-04-17 07:22:03.000000"
Output for 7.1.1
All 3 should show the fractions of second: string(26) "2017-04-17T09:22:03.021215" string(26) "2017-04-17 07:22:03.000000" string(26) "2017-04-17 07:22:03.000000"
Output for 7.1.0
All 3 should show the fractions of second: string(26) "2017-04-17T09:22:03.043797" string(26) "2017-04-17 07:22:03.000000" string(26) "2017-04-17 07:22:03.000000"
Output for 7.0.10
All 3 should show the fractions of second: string(26) "2017-04-17T09:22:04.000000" string(26) "2017-04-17 07:22:04.000000" string(26) "2017-04-17 07:22:04.000000"