3v4l.org

run code in 300+ PHP versions simultaneously
<?php $date_utc = new DateTime('1895-01-01 05:17:32 UTC'); for($i = 1890; $i <= 1900 ; $i++) { $date = new DateTime( $i. '-01-01T00:00', new DateTimeZone('America/Toronto')); echo $date->format('Y-m-d H:i:s'), PHP_EOL; if($i == 1895) $utc_local = $date->format('U') . PHP_EOL; } if(isset($utc_local)) var_dump($date_utc->format('U') . ' => ' . $utc_local, $date->getTimezone()->getTransitions($utc_local, $utc_local));
Output for 8.2.0 - 8.2.18, 8.3.0 - 8.3.4, 8.3.6
1890-01-01 00:00:00 1891-01-01 00:00:00 1892-01-01 00:00:00 1893-01-01 00:00:00 1894-01-01 00:00:00 1895-01-01 00:17:32 1896-01-01 00:00:00 1897-01-01 00:00:00 1898-01-01 00:00:00 1899-01-01 00:00:00 1900-01-01 00:00:00 string(27) "-2366736148 => -2366736148 " array(1) { [0]=> array(5) { ["ts"]=> int(-2366736148) ["time"]=> string(25) "1895-01-01T05:17:32+00:00" ["offset"]=> int(-18000) ["isdst"]=> bool(false) ["abbr"]=> string(3) "EST" } }
Output for 8.3.5
Warning: PHP Startup: Unable to load dynamic library 'sodium.so' (tried: /usr/lib/php/8.3.5/modules/sodium.so (libsodium.so.23: cannot open shared object file: No such file or directory), /usr/lib/php/8.3.5/modules/sodium.so.so (/usr/lib/php/8.3.5/modules/sodium.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0 1890-01-01 00:00:00 1891-01-01 00:00:00 1892-01-01 00:00:00 1893-01-01 00:00:00 1894-01-01 00:00:00 1895-01-01 00:17:32 1896-01-01 00:00:00 1897-01-01 00:00:00 1898-01-01 00:00:00 1899-01-01 00:00:00 1900-01-01 00:00:00 string(27) "-2366736148 => -2366736148 " array(1) { [0]=> array(5) { ["ts"]=> int(-2366736148) ["time"]=> string(25) "1895-01-01T05:17:32+00:00" ["offset"]=> int(-18000) ["isdst"]=> bool(false) ["abbr"]=> string(3) "EST" } }
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.28
1890-01-01 00:00:00 1891-01-01 00:00:00 1892-01-01 00:00:00 1893-01-01 00:00:00 1894-01-01 00:00:00 1895-01-01 00:17:32 1896-01-01 00:00:00 1897-01-01 00:00:00 1898-01-01 00:00:00 1899-01-01 00:00:00 1900-01-01 00:00:00 string(27) "-2366736148 => -2366736148 " array(1) { [0]=> array(5) { ["ts"]=> int(-2366736148) ["time"]=> string(24) "1895-01-01T05:17:32+0000" ["offset"]=> int(-18000) ["isdst"]=> bool(false) ["abbr"]=> string(3) "EST" } }
Output for 7.3.2 - 7.3.33, 7.4.0 - 7.4.33
1890-01-01 00:00:00 1891-01-01 00:00:00 1892-01-01 00:00:00 1893-01-01 00:00:00 1894-01-01 00:00:00 1895-01-01 00:17:32 1896-01-01 00:00:00 1897-01-01 00:00:00 1898-01-01 00:00:00 1899-01-01 00:00:00 1900-01-01 00:00:00 Notice: A non well formed numeric value encountered in /in/CY4F7 on line 11 Notice: A non well formed numeric value encountered in /in/CY4F7 on line 11 string(27) "-2366736148 => -2366736148 " array(1) { [0]=> array(5) { ["ts"]=> int(-2366736148) ["time"]=> string(24) "1895-01-01T05:17:32+0000" ["offset"]=> int(-18000) ["isdst"]=> bool(false) ["abbr"]=> string(3) "EST" } }
Output for 7.3.0 - 7.3.1
1890-01-01 00:00:00 1891-01-01 00:00:00 1892-01-01 00:00:00 1893-01-01 00:00:00 1894-01-01 00:00:00 1895-01-01 00:00:00 1896-01-01 00:00:00 1897-01-01 00:00:00 1898-01-01 00:00:00 1899-01-01 00:00:00 1900-01-01 00:00:00 Notice: A non well formed numeric value encountered in /in/CY4F7 on line 11 Notice: A non well formed numeric value encountered in /in/CY4F7 on line 11 string(27) "-2366736148 => -2366737200 " array(1) { [0]=> array(5) { ["ts"]=> int(-2366737200) ["time"]=> string(24) "1895-01-01T05:00:00+0000" ["offset"]=> int(-19052) ["isdst"]=> bool(false) ["abbr"]=> string(3) "LMT" } }

preferences:
154.45 ms | 403 KiB | 156 Q