3v4l.org

run code in 300+ PHP versions simultaneously
<?php function align_timestamp_to($stamp, $unit, $past){ // timestamp, unit string, start/end static $modes = array( 'year' => 'last year', 'week' => 'last monday', 'month' => 'first day of this month', 'hour' => 'last hour', 'minute' => 'last minute', ); // TODO error out if unknown $unit $offset = $modes[$unit]; if($past == 'end')$offset = '+1 '.$unit.' '.$offset.' -1 second'; return strtotime($offset, $stamp); } foreach(array( array(strtotime('4 Apr 2012'), 'year', 'start'), array(strtotime('4 Apr 2012'), 'year', 'end'), array(strtotime('4 Apr 2012'), 'month', 'start'), array(strtotime('4 Apr 2012'), 'month', 'end'), array(strtotime('4 Apr 2012'), 'week', 'start'), array(strtotime('4 Apr 2012'), 'week', 'end'), ) as $test)echo date('r', $test[0]).' aligned '.str_pad($test[2], 5, ' ', STR_PAD_BOTH).' of ' .str_pad($test[1], 5, ' ', STR_PAD_BOTH).' yields '.date('r', align_timestamp_to($test[0], $test[1], $test[2])).PHP_EOL;

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.3.40.0070.00718.90
8.3.30.0070.00719.22
8.3.20.0040.00420.34
8.3.10.0040.00422.09
8.3.00.0060.00322.43
8.2.170.0040.01122.96
8.2.160.0070.00721.19
8.2.150.0080.00024.18
8.2.140.0040.00424.66
8.2.130.0040.00426.16
8.2.120.0030.00521.19
8.2.110.0090.00321.03
8.2.100.0090.00317.97
8.2.90.0030.00718.28
8.2.80.0040.00418.00
8.2.70.0040.00717.88
8.2.60.0070.00317.80
8.2.50.0040.00418.07
8.2.40.0060.00320.07
8.2.30.0070.00018.17
8.2.20.0040.00417.89
8.2.10.0000.00819.80
8.2.00.0000.00717.92
8.1.270.0060.00322.22
8.1.260.0050.00326.35
8.1.250.0040.00428.09
8.1.240.0090.00320.89
8.1.230.0060.00622.65
8.1.220.0060.00317.91
8.1.210.0030.00618.97
8.1.200.0000.01017.60
8.1.190.0070.00317.60
8.1.180.0090.00018.10
8.1.170.0000.00919.00
8.1.160.0040.00418.91
8.1.150.0030.00618.92
8.1.140.0070.00317.72
8.1.130.0070.00018.03
8.1.120.0040.00417.73
8.1.110.0040.00417.71
8.1.100.0070.00017.75
8.1.90.0000.00717.67
8.1.80.0020.00517.59
8.1.70.0030.00517.69
8.1.60.0040.00417.68
8.1.50.0030.00517.74
8.1.40.0030.00617.75
8.1.30.0040.00417.88
8.1.20.0080.00017.85
8.1.10.0000.00717.77
8.1.00.0000.00817.66
8.0.300.0000.00820.03
8.0.290.0040.00417.00
8.0.280.0000.00718.53
8.0.270.0040.00418.29
8.0.260.0070.00017.08
8.0.250.0000.00717.15
8.0.240.0000.00817.23
8.0.230.0030.00317.23
8.0.220.0000.00717.15
8.0.210.0040.00417.07
8.0.200.0050.00217.24
8.0.190.0060.00317.10
8.0.180.0040.00417.16
8.0.170.0030.00517.20
8.0.160.0080.00017.04
8.0.150.0000.00717.18
8.0.140.0050.00317.10
8.0.130.0000.00513.48
8.0.120.0050.00317.03
8.0.110.0000.00816.99
8.0.100.0040.00417.05
8.0.90.0000.00817.16
8.0.80.0030.01217.17
8.0.70.0000.00816.98
8.0.60.0040.00417.14
8.0.50.0070.00017.00
8.0.30.0130.00817.23
8.0.20.0130.00917.40
8.0.10.0030.00517.29
8.0.00.0120.00617.00
7.4.330.0000.00615.27
7.4.320.0030.00316.70
7.4.300.0040.00416.80
7.4.290.0000.00716.86
7.4.280.0030.00316.56
7.4.270.0060.00316.69
7.4.260.0060.00316.70
7.4.250.0000.00716.79
7.4.240.0040.00416.76
7.4.230.0020.00516.91
7.4.220.0060.01216.77
7.4.210.0070.01116.81
7.4.200.0030.00516.46
7.4.190.0040.00416.98
7.4.160.0090.00916.84
7.4.150.0070.01117.40
7.4.140.0090.00817.86
7.4.130.0100.01016.71
7.4.120.0080.01016.80
7.4.110.0150.00416.68
7.4.100.0060.01216.77
7.4.90.0080.00816.79
7.4.80.0070.01019.39
7.4.70.0110.00716.72
7.4.60.0070.01016.80
7.4.50.0050.00316.49
7.4.40.0100.00522.77
7.4.30.0030.01316.96
7.4.00.0100.00715.00
7.3.330.0000.00513.44
7.3.320.0030.00313.54
7.3.310.0070.00016.43
7.3.300.0000.00816.43
7.3.290.0120.00616.48
7.3.280.0110.00516.51
7.3.270.0030.01617.40
7.3.260.0100.00716.58
7.3.250.0140.00516.67
7.3.240.0100.00716.53
7.3.230.0130.00316.80
7.3.210.0060.01116.86
7.3.200.0030.01319.39
7.3.190.0190.00316.82
7.3.180.0000.01616.87
7.3.170.0100.01316.67
7.3.160.0060.01216.57
7.3.120.0080.00615.22
7.2.330.0110.00816.93
7.2.320.0070.01117.14
7.2.310.0070.01117.07
7.2.300.0090.00617.06
7.2.290.0180.00317.06
7.2.60.0100.00317.24
7.2.00.0030.00719.43
7.1.200.0080.00315.91
7.1.100.0040.00718.45
7.1.70.0070.00017.45
7.1.60.0160.00619.82
7.1.50.0140.00717.28
7.1.00.0070.07022.27
7.0.200.0110.00417.00
7.0.140.0030.07322.11
7.0.90.0330.08020.00
7.0.80.0200.05319.96
7.0.70.0600.08019.95
7.0.60.0330.05019.96
7.0.50.0130.05020.34
7.0.40.0130.04019.96
7.0.30.0100.07020.11
7.0.20.0170.04020.19
7.0.10.0030.04320.02
7.0.00.0200.07320.07
5.6.280.0000.07720.85
5.6.240.0070.04720.68
5.6.230.0170.05720.54
5.6.220.0030.04320.48
5.6.210.0030.08720.76
5.6.200.0200.07321.12
5.6.190.0070.08321.05
5.6.180.0100.04721.08
5.6.170.0200.07021.05
5.6.160.0030.08021.15
5.6.150.0130.06721.13
5.6.140.0100.07020.97
5.6.130.0100.08321.13
5.6.120.0170.03321.13
5.6.110.0030.04321.05
5.6.100.0030.06320.94
5.6.90.0130.07321.04
5.6.80.0170.07020.34
5.6.70.0070.07020.35
5.6.60.0030.08320.52
5.6.50.0130.07020.42
5.6.40.0100.05320.38
5.6.30.0130.07320.34
5.6.20.0000.05320.45
5.6.10.0070.07720.46
5.6.00.0000.09020.46
5.5.380.0070.06320.46
5.5.370.0100.08720.38
5.5.360.0100.08020.40
5.5.350.0230.06720.41
5.5.340.0200.06320.91
5.5.330.0070.07720.94
5.5.320.0030.08320.82
5.5.310.0100.04720.87
5.5.300.0100.07320.80
5.5.290.0070.05020.89
5.5.280.0200.07020.92
5.5.270.0130.06320.93
5.5.260.0000.05320.88
5.5.250.0100.06020.69
5.5.240.0100.04020.17
5.5.230.0070.05020.26
5.5.220.0070.07720.21
5.5.210.0130.07320.14
5.5.200.0170.07020.20
5.5.190.0070.06320.23
5.5.180.0030.04720.14
5.5.160.0200.06320.15
5.5.150.0070.06720.23
5.5.140.0130.06720.14
5.5.130.0000.08320.13
5.5.120.0070.07320.17
5.5.110.0030.07320.22
5.5.100.0100.07320.11
5.5.90.0130.06320.22
5.5.80.0000.05720.07
5.5.70.0100.07020.16
5.5.60.0100.07020.06
5.5.50.0100.07019.95
5.5.40.0070.06320.07
5.5.30.0070.06020.16
5.5.20.0000.06720.04
5.5.10.0030.05320.15
5.5.00.0100.03319.98
5.4.450.0000.07319.42
5.4.440.0100.07719.37
5.4.430.0070.07719.32
5.4.420.0030.08719.41
5.4.410.0070.07319.14
5.4.400.0030.05018.91
5.4.390.0000.05719.12
5.4.380.0100.06319.13
5.4.370.0030.07718.95
5.4.360.0070.08319.13
5.4.350.0130.06318.87
5.4.340.0130.06718.95
5.4.320.0130.07019.04
5.4.310.0070.06718.95
5.4.300.0100.06718.94
5.4.290.0100.06019.14
5.4.280.0070.06719.13
5.4.270.0000.08319.13
5.4.260.0030.04019.18
5.4.250.0070.08018.87
5.4.240.0170.06319.04
5.4.230.0030.03319.17
5.4.220.0070.04719.23
5.4.210.0030.03718.90
5.4.200.0130.04019.04
5.4.190.0130.02718.89
5.4.180.0070.05719.13
5.4.170.0130.06319.02
5.4.160.0100.06718.82
5.4.150.0100.07718.93
5.4.140.0030.07716.43
5.4.130.0100.06716.38
5.4.120.0070.07016.20
5.4.110.0130.06716.47
5.4.100.0100.04316.39
5.4.90.0100.03716.51
5.4.80.0000.07316.52
5.4.70.0030.07316.39
5.4.60.0070.04716.50
5.4.50.0030.07316.47
5.4.40.0130.06716.38
5.4.30.0070.07716.47
5.4.20.0100.06016.25
5.4.10.0100.07316.44
5.4.00.0030.04015.89
5.3.290.0100.06014.69
5.3.280.0070.07714.56
5.3.270.0030.03714.77
5.3.260.0000.05314.68
5.3.250.0100.07714.76
5.3.240.0070.05014.68
5.3.230.0100.07714.68
5.3.220.0100.07014.56
5.3.210.0100.07014.51
5.3.200.0130.06014.55
5.3.190.0100.08014.59
5.3.180.0070.05314.64
5.3.170.0070.04014.63
5.3.160.0030.07314.72
5.3.150.0070.03714.69
5.3.140.0130.07714.59
5.3.130.0030.05014.60
5.3.120.0100.04714.59
5.3.110.0030.07714.58
5.3.100.0100.07014.05
5.3.90.0070.06014.09
5.3.80.0100.06314.09
5.3.70.0070.06314.12
5.3.60.0030.08014.12
5.3.50.0130.03314.10
5.3.40.0070.03013.89
5.3.30.0000.03713.86
5.3.20.0030.03313.63
5.3.10.0000.03313.70
5.3.00.0030.03313.55
5.2.170.0070.04311.07
5.2.160.0000.04011.08
5.2.150.0030.02711.22
5.2.140.0030.03010.97
5.2.130.0000.04011.14
5.2.120.0070.02711.04
5.2.110.0000.03011.22
5.2.100.0000.04311.23
5.2.90.0000.03011.04
5.2.80.0070.02310.98
5.2.70.0030.03011.18
5.2.60.0030.02710.95
5.2.50.0070.02311.17
5.2.40.0000.03311.11
5.2.30.0000.03011.13
5.2.20.0030.03711.09
5.2.10.0000.03010.86
5.2.00.0030.02710.67
5.1.60.0030.02310.33
5.1.50.0030.02310.33
5.1.40.0000.02710.33
5.1.30.0070.02310.37
5.1.20.0030.02310.33
5.1.10.0000.02710.33
5.1.00.0000.03010.33
5.0.50.0000.02710.33
5.0.40.0030.02710.33
5.0.30.0030.03310.33
5.0.20.0000.02710.33
5.0.10.0000.02010.33
5.0.00.0030.02310.33
4.4.90.0070.01010.33
4.4.80.0030.01010.33
4.4.70.0000.02010.33
4.4.60.0000.02010.33
4.4.50.0000.02010.33
4.4.40.0030.02010.33
4.4.30.0000.04010.33
4.4.20.0000.01710.33
4.4.10.0000.01710.33
4.4.00.0000.02310.33
4.3.110.0000.01710.33
4.3.100.0000.02310.33
4.3.90.0000.01710.33
4.3.80.0030.02310.33
4.3.70.0030.01310.33
4.3.60.0030.01010.33
4.3.50.0000.01710.33
4.3.40.0030.01710.33
4.3.30.0000.01710.33
4.3.20.0000.03010.33
4.3.10.0000.02010.33
4.3.00.0000.01710.33

preferences:
45 ms | 400 KiB | 5 Q