3v4l.org

run code in 300+ PHP versions simultaneously
<?php $dt = new DateTime(); $dt->setTimestamp(3.4); // I replaced 3.4 by microtime(true), this is just to give an example var_dump($dt); var_dump($dt->format('u'));
Output for 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
Deprecated: Implicit conversion from float 3.4 to int loses precision in /in/hPVdT on line 4 object(DateTime)#1 (3) { ["date"]=> string(26) "1970-01-01 01:00:03.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } string(6) "000000"
Output for 5.5.14 - 5.5.38, 5.6.0 - 5.6.40, 7.0.0 - 7.0.33, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.31, 7.4.0 - 7.4.33, 8.0.0 - 8.0.12, 8.0.14 - 8.0.30
object(DateTime)#1 (3) { ["date"]=> string(26) "1970-01-01 01:00:03.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } string(6) "000000"
Output for 7.3.32 - 7.3.33, 8.0.13
object(DateTime)#1 (3) { ["date"]=> string(26) "1970-01-01 00:00:03.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(3) "UTC" } string(6) "000000"
Output for 5.5.0 - 5.5.13
object(DateTime)#1 (3) { ["date"]=> string(19) "1970-01-01 01:00:03" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } string(6) "000000"

preferences:
238.69 ms | 402 KiB | 335 Q