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 '.$test[2].' of '.$test[1].' yields '.date('r', align_timestamp_to($test[0], $test[1], $test[2])).'<br/>';

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.60.0070.01416.74
8.3.50.0040.01122.02
8.3.40.0190.00019.05
8.3.30.0080.00819.21
8.3.20.0040.00420.16
8.3.10.0090.00623.48
8.3.00.0030.00619.22
8.2.180.0110.00718.41
8.2.170.0080.00622.96
8.2.160.0070.00720.39
8.2.150.0000.00824.18
8.2.140.0040.00424.66
8.2.130.0090.00926.16
8.2.120.0000.00822.38
8.2.110.0100.00319.39
8.2.100.0130.00018.02
8.2.90.0000.00819.34
8.2.80.0040.00417.97
8.2.70.0040.00417.88
8.2.60.0000.00818.18
8.2.50.0030.00518.10
8.2.40.0070.00418.33
8.2.30.0040.00418.16
8.2.20.0000.00718.01
8.2.10.0040.00419.78
8.2.00.0000.00818.04
8.1.280.0100.01025.92
8.1.270.0040.00422.09
8.1.260.0180.00026.35
8.1.250.0070.00728.09
8.1.240.0060.00322.65
8.1.230.0090.00318.00
8.1.220.0000.00817.77
8.1.210.0030.00518.77
8.1.200.0030.00717.38
8.1.190.0040.00417.47
8.1.180.0080.00018.10
8.1.170.0060.00318.77
8.1.160.0000.00822.12
8.1.150.0030.00618.82
8.1.140.0000.00717.73
8.1.130.0000.00718.05
8.1.120.0000.00817.75
8.1.110.0000.01017.62
8.1.100.0050.00217.75
8.1.90.0000.00717.72
8.1.80.0030.00317.65
8.1.70.0030.00617.66
8.1.60.0000.00817.81
8.1.50.0000.00817.71
8.1.40.0040.00417.81
8.1.30.0040.00417.87
8.1.20.0000.00817.77
8.1.10.0040.00417.76
8.1.00.0040.00417.76
8.0.300.0030.00618.77
8.0.290.0040.00417.00
8.0.280.0070.00018.53
8.0.270.0080.00017.30
8.0.260.0040.00417.00
8.0.250.0070.00017.23
8.0.240.0000.00717.23
8.0.230.0000.00717.19
8.0.220.0040.00417.25
8.0.210.0000.00717.15
8.0.200.0000.00717.24
8.0.190.0080.00017.27
8.0.180.0060.00317.07
8.0.170.0000.00717.13
8.0.160.0040.00417.25
8.0.150.0070.00017.00
8.0.140.0030.00517.16
8.0.130.0030.00313.52
8.0.120.0040.00417.11
8.0.110.0050.00217.20
8.0.100.0040.00416.96
8.0.90.0070.00017.23
8.0.80.0060.00917.14
8.0.70.0070.00016.98
8.0.60.0030.00517.10
8.0.50.0000.00717.14
8.0.30.0090.01517.26
8.0.20.0110.00817.41
8.0.10.0000.00817.16
8.0.00.0080.01016.98
7.4.330.0050.00015.11
7.4.320.0000.00816.84
7.4.300.0090.00016.80
7.4.290.0070.00016.62
7.4.280.0000.00716.85
7.4.270.0000.00716.69
7.4.260.0050.00216.79
7.4.250.0000.00716.64
7.4.240.0040.00316.79
7.4.230.0000.00816.83
7.4.220.0050.01416.82
7.4.210.0060.00916.77
7.4.200.0000.00716.86
7.4.190.0000.00716.64
7.4.160.0100.00616.77
7.4.150.0190.00317.40
7.4.140.0080.01217.86
7.4.130.0080.01116.80
7.4.120.0110.00816.78
7.4.110.0140.00416.70
7.4.100.0160.00016.80
7.4.90.0070.01016.87
7.4.80.0070.01119.39
7.4.70.0130.00316.79
7.4.60.0060.01116.75
7.4.50.0000.00517.03
7.4.40.0090.00522.77
7.4.30.0060.01116.77
7.4.10.0070.01015.28
7.4.00.0030.01315.23
7.3.330.0000.00513.59
7.3.320.0050.00013.57
7.3.310.0000.00816.62
7.3.300.0040.00416.59
7.3.290.0080.00916.60
7.3.280.0080.01116.55
7.3.270.0180.00317.40
7.3.260.0000.01816.86
7.3.250.0100.00916.66
7.3.240.0090.01216.79
7.3.230.0070.01316.46
7.3.210.0190.00016.88
7.3.200.0190.00319.39
7.3.190.0130.00616.88
7.3.180.0070.01016.78
7.3.170.0080.00816.81
7.3.160.0070.01416.70
7.3.130.0070.01014.68
7.3.120.0090.00615.24
7.3.110.0050.00615.13
7.3.100.0080.00515.26
7.3.90.0000.01615.13
7.3.80.0110.00314.87
7.3.70.0070.00415.17
7.3.60.0040.01314.79
7.3.50.0030.01014.84
7.3.40.0050.00915.00
7.3.30.0070.00614.89
7.3.20.0050.00916.89
7.3.10.0050.00616.94
7.3.00.0080.00816.78
7.2.330.0110.00816.96
7.2.320.0100.00717.11
7.2.310.0160.00616.77
7.2.300.0060.01217.19
7.2.290.0100.00617.08
7.2.260.0070.01115.48
7.2.250.0040.01115.39
7.2.240.0080.00815.44
7.2.230.0100.00515.39
7.2.220.0070.01015.28
7.2.210.0050.00815.27
7.2.200.0090.00315.35
7.2.190.0050.00715.24
7.2.180.0050.00915.12
7.2.170.0070.00715.37
7.2.160.0050.00915.29
7.2.150.0050.00917.08
7.2.140.0000.01317.16
7.2.130.0080.00617.20
7.2.120.0070.00517.02
7.2.110.0040.00917.27
7.2.100.0060.00917.25
7.2.90.0050.00717.19
7.2.80.0070.00717.19
7.2.70.0050.00517.23
7.2.60.0100.00617.02
7.2.50.0100.00317.01
7.2.40.0050.00917.30
7.2.30.0090.00517.24
7.2.20.0090.00317.18
7.2.10.0040.01016.96
7.2.00.0090.00617.94
7.1.330.0090.00515.94
7.1.320.0100.00516.12
7.1.310.0050.00915.94
7.1.300.0080.00315.87
7.1.290.0030.00615.85
7.1.280.0060.00615.90
7.1.270.0060.00815.98
7.1.260.0020.01316.09
7.1.250.0020.01216.10
7.1.240.0050.00715.98
7.1.230.0000.01016.05
7.1.220.0050.00815.85
7.1.210.0050.00516.06
7.1.200.0090.00515.95
7.1.190.0030.00816.14
7.1.180.0060.00615.73
7.1.170.0110.00216.06
7.1.160.0050.00816.06
7.1.150.0070.00515.96
7.1.140.0050.00916.02
7.1.130.0060.00216.10
7.1.120.0090.00415.84
7.1.110.0010.01216.00
7.1.100.0040.00816.81
7.1.90.0070.00115.82
7.1.80.0060.00516.12
7.1.70.0030.01016.49
7.1.60.0030.01017.25
7.1.50.0050.00916.41
7.1.40.0030.00816.13
7.1.30.0070.00715.91
7.1.20.0050.00716.06
7.1.10.0050.00916.15
7.1.00.0040.03218.04
7.0.330.0050.00515.54
7.0.320.0020.01315.51
7.0.310.0070.00815.34
7.0.300.0110.00315.63
7.0.290.0080.00315.54
7.0.280.0060.00615.37
7.0.270.0080.00515.59
7.0.260.0030.00915.74
7.0.250.0100.00215.64
7.0.240.0030.01015.68
7.0.230.0090.00315.57
7.0.220.0060.00915.52
7.0.210.0020.01015.67
7.0.200.0020.00815.92
7.0.190.0020.01015.41
7.0.180.0070.00615.59
7.0.170.0020.00715.45
7.0.160.0060.00615.50
7.0.150.0040.00515.49
7.0.140.0060.02917.81
7.0.130.0050.01015.73
7.0.120.0100.00615.56
7.0.110.0070.02517.17
7.0.100.0060.01817.01
7.0.90.0120.01116.99
7.0.80.0060.02216.91
7.0.70.0100.02117.17
7.0.60.0040.03317.15
7.0.50.0070.02017.02
7.0.40.0060.02815.72
7.0.30.0060.01815.83
7.0.20.0090.01715.67
7.0.10.0070.02115.59
7.0.00.0030.03215.72
5.6.400.0050.01014.54
5.6.390.0030.00914.52
5.6.380.0060.00514.63
5.6.370.0060.00614.52
5.6.360.0120.00514.56
5.6.350.0070.00314.59
5.6.340.0070.00814.75
5.6.330.0070.00814.65
5.6.320.0050.00614.81
5.6.310.0060.00614.40
5.6.300.0070.00614.71
5.6.290.0100.00514.73
5.6.280.0060.03016.76
5.6.270.0090.00414.67
5.6.260.0020.02716.48
5.6.250.0110.02616.66
5.6.240.0040.02016.59
5.6.230.0030.02016.68
5.6.220.0070.02816.57
5.6.210.0030.02216.56
5.6.200.0080.01816.60
5.6.190.0030.02116.67
5.6.180.0100.02616.63
5.6.170.0040.01716.66
5.6.160.0030.02016.51
5.6.150.0060.02816.64
5.6.140.0010.02816.66
5.6.130.0080.02116.60
5.6.120.0030.02516.64
5.6.110.0050.02216.64
5.6.100.0050.02916.61
5.6.90.0020.02516.61
5.6.80.0030.03016.18
5.6.70.0090.02616.18
5.6.60.0060.02916.36
5.6.50.0120.01516.14
5.6.40.0110.02416.28
5.6.30.0050.02116.27
5.6.20.0070.02916.39
5.6.10.0050.01916.36
5.6.00.0100.02616.25
5.5.380.0050.02515.47
5.5.370.0020.02015.53
5.5.360.0060.01715.47
5.5.350.0040.03215.61
5.5.340.0080.03115.68
5.5.330.0070.03115.64
5.5.320.0040.03415.66
5.5.310.0010.03515.66
5.5.300.0040.01915.75
5.5.290.0000.02615.67
5.5.280.0080.02915.67
5.5.270.0080.01715.68
5.5.260.0040.02415.58
5.5.250.0020.02115.73
5.5.240.0090.02815.56
5.5.230.0080.02915.28
5.5.220.0070.02915.57
5.5.210.0000.02515.42
5.5.200.0080.02915.45
5.5.190.0040.02115.53
5.5.180.0020.02615.45
5.5.170.0030.00814.37
5.5.160.0100.02615.52
5.5.150.0110.01415.45
5.5.140.0030.02015.38
5.5.130.0050.01815.50
5.5.120.0100.02715.45
5.5.110.0010.02515.49
5.5.100.0020.02015.37
5.5.90.0030.02115.29
5.5.80.0060.01715.37
5.5.70.0070.01515.65
5.5.60.0040.02215.24
5.5.50.0050.01515.51
5.5.40.0110.01615.49
5.5.30.0100.02515.50
5.5.20.0060.02015.29
5.5.10.0070.02215.38
5.5.00.0030.02015.33
5.4.450.0080.01214.77
5.4.440.0060.02414.67
5.4.430.0060.02814.71
5.4.420.0110.02414.73
5.4.410.0040.01814.73
5.4.400.0050.03114.61
5.4.390.0060.02714.59
5.4.380.0050.01914.56
5.4.370.0020.03114.60
5.4.360.0050.02514.54
5.4.350.0110.01714.66
5.4.340.0080.01914.63
5.4.330.0070.00412.34
5.4.320.0070.01914.57
5.4.310.0050.01314.54
5.4.300.0060.02214.56
5.4.290.0030.02214.56
5.4.280.0040.02014.67
5.4.270.0070.02614.55
5.4.260.0040.01414.63
5.4.250.0040.01914.56
5.4.240.0030.01814.63
5.4.230.0030.02814.56
5.4.220.0030.02914.58
5.4.210.0050.02014.55
5.4.200.0060.02314.56
5.4.190.0060.01714.66
5.4.180.0060.01314.64
5.4.170.0060.01714.55
5.4.160.0040.01914.63
5.4.150.0050.02914.56
5.4.140.0010.01813.70
5.4.130.0020.02213.71
5.4.120.0060.02713.68
5.4.110.0060.01313.66
5.4.100.0070.03013.70
5.4.90.0060.02313.68
5.4.80.0070.01213.75
5.4.70.0010.02013.71
5.4.60.0050.02513.72
5.4.50.0010.03113.74
5.4.40.0050.02513.72
5.4.30.0010.02113.74
5.4.20.0080.02513.67
5.4.10.0060.02913.71
5.4.00.0020.03213.48
5.3.290.0050.02713.13
5.3.280.0030.01613.14
5.3.270.0080.01613.10
5.3.260.0040.02313.05
5.3.250.0060.01513.11
5.3.240.0020.01513.09
5.3.230.0060.01813.05
5.3.220.0030.02713.08
5.3.210.0050.01513.13
5.3.200.0070.02413.08
5.3.190.0030.02213.10
5.3.180.0030.02313.04
5.3.170.0060.01413.08
5.3.160.0070.02613.13
5.3.150.0050.02713.09
5.3.140.0080.01313.12
5.3.130.0060.01513.08
5.3.120.0020.01613.08
5.3.110.0030.03113.07
5.3.100.0060.02612.91
5.3.90.0020.01912.90
5.3.80.0040.02812.95
5.3.70.0070.01312.90
5.3.60.0020.01612.90
5.3.50.0000.02012.91
5.3.40.0040.01512.88
5.3.30.0030.02612.86
5.3.20.0040.01512.84
5.3.10.0010.01812.81
5.3.00.0080.02212.80
5.2.170.0000.03012.06
5.2.160.0030.03012.06
5.2.150.0030.03012.06
5.2.140.0030.04012.06
5.2.130.0030.06012.06
5.2.120.0030.07012.06
5.2.110.0070.05012.06
5.2.100.0030.02312.06
5.2.90.0000.03712.06
5.2.80.0000.08012.06
5.2.70.0030.02312.06
5.2.60.0030.04712.06
5.2.50.0000.04312.06
5.2.40.0100.05712.06
5.2.30.0030.05012.06
5.2.20.0070.04712.06
5.2.10.0030.05012.06
5.2.00.0000.06712.06
5.1.60.0000.06012.06
5.1.50.0000.02712.06
5.1.40.0100.04712.06
5.1.30.0000.05712.06
5.1.20.0030.05312.06
5.1.10.0070.05312.06
5.1.00.0100.03712.06
5.0.50.0000.02012.06
5.0.40.0000.02312.06
5.0.30.0030.04312.06
5.0.20.0000.02712.06
5.0.10.0030.02012.06
5.0.00.0000.03712.06
4.4.90.0000.03012.06
4.4.80.0000.02312.06
4.4.70.0000.03712.06
4.4.60.0000.03312.06
4.4.50.0030.03012.06
4.4.40.0000.05012.06
4.4.30.0000.02012.06
4.4.20.0000.03712.06
4.4.10.0070.01712.06
4.4.00.0000.02712.06
4.3.110.0000.03312.06
4.3.100.0000.03012.06
4.3.90.0030.01012.06
4.3.80.0030.02312.06
4.3.70.0030.01312.06
4.3.60.0000.01712.06
4.3.50.0030.01312.06
4.3.40.0000.02312.06
4.3.30.0000.01712.06
4.3.20.0030.01312.06
4.3.10.0000.01312.06
4.3.00.0000.01312.06

preferences:
45.22 ms | 401 KiB | 5 Q