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', ); /** * give each time (unix timestamp) its own color * * @param $time * @return string */ function time_color($time) { static $colors = array('black', 'copper', 'blue', 'lime', 'green', 'pink', 'red'); static $coloredTime = array(-1 => ' ?! '); if (!isset($coloredTime[$time])) { $coloredTime[$time] = array_pop($colors); } return $coloredTime[$time]; } $time = strtotime('UTC 2020-01-01 00:00:00'); $format1 = "(default time-zone is ..: %s)\n"; if (is_callable('date_default_timezone_get')) { printf($format1, date_default_timezone_get()); } else { printf($format1, '??? (unknown)'); } printf("UTC time is ............: [%-6s] %d (script-time, UTC 2020-01-01 00:00:00)\n", time_color($time), $time); foreach ($formats as $format) { $strToTime = strtotime($format, $time); printf("%'.-24s: [%-6s] %d\n", "$format ", time_color($strToTime), $strToTime); }

Here you find the average performance (time & memory) of each version. A grayed out version indicates it didn't complete successfully (based on exit-code).

VersionSystem time (s)User time (s)Memory (MiB)
8.1.70.0030.00317.57
8.1.60.0080.00417.76
8.1.50.0110.00417.71
8.1.40.0090.00717.64
8.1.30.0100.00317.75
8.1.20.0080.00617.73
8.1.10.0090.00517.72
8.1.00.0090.00417.70
8.0.200.0080.00017.08
8.0.190.0090.00317.18
8.0.180.0070.00417.20
8.0.170.0090.00317.09
8.0.160.0050.00717.12
8.0.150.0090.00317.05
8.0.140.0040.00817.10
8.0.130.0050.00615.85
8.0.120.0060.00516.21
8.0.110.0080.00416.18
8.0.100.0070.00416.46
8.0.90.0090.00416.16
8.0.80.0110.00216.22
8.0.70.0040.00816.21
8.0.60.0110.00116.17
8.0.50.0080.00516.21
8.0.30.0060.00616.19
8.0.20.0080.00516.23
8.0.10.0070.00516.37
8.0.00.0040.00516.32
7.4.300.0050.00216.79
7.4.290.0090.00316.61
7.4.280.0120.00116.78
7.4.270.0100.00216.74
7.4.260.0060.00515.59
7.4.250.0100.00315.94
7.4.240.0100.00415.89
7.4.230.0110.00615.89
7.4.220.0110.00315.87
7.4.210.0080.00615.91
7.4.200.0100.00415.90
7.4.190.0040.00915.91
7.4.180.0110.00316.02
7.4.160.0100.00315.98
7.4.150.0100.00415.86
7.4.140.0100.00415.85
7.4.130.0090.00415.85
7.4.120.0090.00415.89
7.4.110.0100.00315.79
7.4.100.0120.00215.97
7.4.90.0090.00515.85
7.4.80.0100.00315.89
7.4.70.0120.00215.85
7.4.60.0110.00315.81
7.4.50.0120.00215.77
7.4.40.0100.00315.69
7.4.30.0090.00515.87
7.4.20.0100.00415.81
7.4.10.0100.00415.86
7.4.00.0100.00415.86
7.3.330.0080.00516.52
7.3.320.0080.00515.00
7.3.310.0120.00115.83
7.3.300.0080.00515.84
7.3.290.0080.00615.77
7.3.280.0090.00515.79
7.3.270.0110.00315.89
7.3.260.0090.00415.88
7.3.250.0110.00315.85
7.3.240.0100.00415.74
7.3.230.0120.00315.77
7.3.220.0090.00415.79
7.3.210.0100.00515.74
7.3.200.0100.00515.73
7.3.190.0080.00515.66
7.3.180.0080.00515.77
7.3.170.0100.00315.79
7.3.160.0080.00515.74
7.3.150.0070.00415.63
7.3.140.0100.00315.64
7.3.130.0080.00515.79
7.3.120.0100.00215.70
7.3.110.0100.00215.74
7.3.100.0070.00515.59
7.3.90.0070.00415.93
7.3.80.0080.00415.61
7.3.70.0090.00315.79
7.3.60.0070.00415.87
7.3.50.0090.00415.87
7.3.40.0080.00515.90
7.3.30.0100.00215.84
7.3.20.0090.00417.70
7.3.10.0080.00517.63
7.3.00.0080.00517.61

preferences:
11.75 ms | 406 KiB | 5 Q