3v4l.org

run code in 300+ PHP versions simultaneously
<?php /** * @link https://stackoverflow.com/a/13129856/367456 */ $formats = array( 'today midnight', 'midnight', 'today', 'TODAY', 'MidNight', 'ToDaY', 'tomorrow', 'UTC today', 'today Z', 'today Europe/Berlin', 'Asia/Shanghai today', 'Asia/Shanghai', 'HKST today', ); $time = strtotime('UTC 2020-01-01 00:00:00'); printf("UTC time is: %d (script-time, is UTC 2020-01-01 00:00:00)\n", $time); if (is_callable('date_default_timezone_get')) { printf("default time-zone is: %s\n", date_default_timezone_get()); } else { printf("default time-zone is: %s\n", '???'); } foreach ($formats as $format) { printf("%'.-24s: %s\n", "$format ", strtotime($format, $time)); }
Output for 5.1.2 - 5.1.6, 5.2.0 - 5.2.17, 5.3.0 - 5.3.29, 5.4.0 - 5.4.45, 5.5.0 - 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.3.33, 7.4.0 - 7.4.25, 7.4.27 - 7.4.29, 8.0.0 - 8.0.12, 8.0.14 - 8.0.19, 8.1.0 - 8.1.6
UTC time is: 1577836800 (script-time, is UTC 2020-01-01 00:00:00) default time-zone is: Europe/Amsterdam today midnight .........: 1577833200 midnight ...............: 1577833200 today ..................: 1577833200 TODAY ..................: 1577833200 MidNight ...............: 1577833200 ToDaY ..................: 1577833200 tomorrow ...............: 1577919600 UTC today ..............: 1577836800 today Z ................: 1577836800 today Europe/Berlin ....: 1577833200 Asia/Shanghai today ....: 1577808000 Asia/Shanghai ..........: 1577811600 HKST today .............: 1577804400
Output for 7.3.32, 7.4.26, 8.0.13
UTC time is: 1577836800 (script-time, is UTC 2020-01-01 00:00:00) default time-zone is: UTC today midnight .........: 1577836800 midnight ...............: 1577836800 today ..................: 1577836800 TODAY ..................: 1577836800 MidNight ...............: 1577836800 ToDaY ..................: 1577836800 tomorrow ...............: 1577923200 UTC today ..............: 1577836800 today Z ................: 1577836800 today Europe/Berlin ....: 1577833200 Asia/Shanghai today ....: 1577808000 Asia/Shanghai ..........: 1577808000 HKST today .............: 1577804400
Output for 5.1.0 - 5.1.1
UTC time is: 0 (script-time, is UTC 2020-01-01 00:00:00) default time-zone is: Europe/Amsterdam today midnight .........: midnight ...............: today ..................: TODAY ..................: MidNight ...............: ToDaY ..................: tomorrow ...............: UTC today ..............: today Z ................: today Europe/Berlin ....: Asia/Shanghai today ....: Asia/Shanghai ..........: HKST today .............:
Output for 4.3.0 - 4.3.11, 4.4.0 - 4.4.9, 5.0.3 - 5.0.5
UTC time is: 1577836800 (script-time, is UTC 2020-01-01 00:00:00) default time-zone is: ??? today midnight .........: -1 midnight ...............: -1 today ..................: 1577836800 TODAY ..................: 1577836800 MidNight ...............: -1 ToDaY ..................: 1577836800 tomorrow ...............: 1577923200 UTC today ..............: 1577840400 today Z ................: 1577840400 today Europe/Berlin ....: -1 Asia/Shanghai today ....: -1 Asia/Shanghai ..........: -1 HKST today .............: -1
Output for 5.0.0 - 5.0.2
UTC time is: 1577836800 (script-time, is UTC 2020-01-01 00:00:00) default time-zone is: ??? today midnight .........: -1 midnight ...............: -1 today ..................: 1577833200 TODAY ..................: 1577833200 MidNight ...............: -1 ToDaY ..................: 1577833200 tomorrow ...............: 1577919600 UTC today ..............: 1577836800 today Z ................: 1577836800 today Europe/Berlin ....: -1 Asia/Shanghai today ....: -1 Asia/Shanghai ..........: -1 HKST today .............: -1

preferences:
146.63 ms | 417 KiB | 5 Q