3v4l.org

run code in 300+ PHP versions simultaneously
<?php function _getRollingMonths($months = 12) { $currentTime = strtotime('2015-01-30'); $dates = array(); for($i=$months-1;$i>=0;$i--) { $dates[] = array( 'year' => date('Y', strtotime("first day of -$i months", $currentTime)), 'month' => date('m', strtotime("first day of -$i months", $currentTime)), 'monthName' => date('M', strtotime("first day of -$i months", $currentTime)) ); } return $dates; } function _getMonths($year = null) { if (!isset($year)) { $year = date('Y'); } $dates = array(); for($month=1;$month<=12;$month++) { $dates[] = array( 'year' => date('Y', strtotime("$year-$month-01")), 'month' => date('m', strtotime("$year-$month-01")), 'monthName' => date('M', strtotime("$year-$month-01")) ); } return $dates; } function _getYTDMonths($year = null) { if (!isset($year)) { $year = date('Y'); } $dates = array(); for($i=date('m')-1;$i>=0;$i--) { $dates[] = array( 'year' => $year, 'month' => date('m', strtotime("first day of -$i months")), 'monthName' => date('M', strtotime("first day of -$i months")) ); if (date('m', strtotime("-$i months")) == date('m')) { $dates[count($dates)-1]['day'] = date('d', strtotime("-$i months")); } } return $dates; } function debug($var) { echo "<pre>"; print_r($var); echo "</pre>"; } debug(date('Y-m-d H:i:s', strtotime('-1 second', strtotime('+1 month', strtotime('2015-01-01 00:00:00')))));

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.0130.00618.14
8.3.50.0100.00718.05
8.3.40.0120.00318.97
8.3.30.0110.00419.27
8.3.20.0070.00020.34
8.3.10.0050.00321.90
8.3.00.0030.00518.98
8.2.180.0110.00718.54
8.2.170.0130.00722.96
8.2.160.0040.00922.30
8.2.150.0060.00324.18
8.2.140.0030.00524.66
8.2.130.0050.00226.16
8.2.120.0050.00319.54
8.2.110.0030.00622.27
8.2.100.0110.00017.84
8.2.90.0000.00819.38
8.2.80.0000.00917.97
8.2.70.0030.00617.63
8.2.60.0030.00618.05
8.2.50.0000.00818.07
8.2.40.0060.00318.16
8.2.30.0060.00318.09
8.2.20.0080.00017.86
8.2.10.0080.00017.98
8.2.00.0040.00417.90
8.1.280.0040.01125.92
8.1.270.0000.00918.95
8.1.260.0000.00726.35
8.1.250.0030.00528.09
8.1.240.0090.00024.04
8.1.230.0040.00719.23
8.1.220.0040.00417.74
8.1.210.0040.00418.77
8.1.200.0060.00317.48
8.1.190.0050.00317.35
8.1.180.0000.00819.01
8.1.170.0090.00018.61
8.1.160.0000.00822.10
8.1.150.0040.00418.97
8.1.140.0040.00419.36
8.1.130.0030.00317.98
8.1.120.0030.00517.67
8.1.110.0040.00417.55
8.1.100.0000.00717.64
8.1.90.0050.00317.63
8.1.80.0000.00817.55
8.1.70.0000.00717.62
8.1.60.0030.00717.63
8.1.50.0090.00317.57
8.1.40.0030.00617.60
8.1.30.0030.00617.88
8.1.20.0040.00417.77
8.1.10.0000.00817.57
8.1.00.0040.00417.67
8.0.300.0050.00218.77
8.0.290.0080.00017.13
8.0.280.0030.00318.55
8.0.270.0000.00717.41
8.0.260.0030.00517.27
8.0.250.0030.00317.13
8.0.240.0000.00617.01
8.0.230.0000.00717.14
8.0.220.0030.00317.12
8.0.210.0040.00416.99
8.0.200.0000.00616.98
8.0.190.0060.00317.11
8.0.180.0040.00417.01
8.0.170.0040.00417.12
8.0.160.0030.00316.97
8.0.150.0030.00516.95
8.0.140.0000.00716.93
8.0.130.0000.00713.32
8.0.120.0040.00417.04
8.0.110.0000.00717.02
8.0.100.0070.00017.06
8.0.90.0050.00216.96
8.0.80.0100.00616.95
8.0.70.0040.00417.04
8.0.60.0020.00517.11
8.0.50.0020.00516.85
8.0.30.0160.01017.22
8.0.20.0060.01417.43
8.0.10.0060.00317.22
8.0.00.0080.01116.81
7.4.330.0020.00215.05
7.4.320.0030.00316.73
7.4.300.0040.00416.67
7.4.290.0030.00316.62
7.4.280.0030.00616.66
7.4.270.0030.00316.72
7.4.260.0050.00516.65
7.4.250.0000.00816.72
7.4.240.0000.00816.79
7.4.230.0030.00316.51
7.4.220.0090.00816.62
7.4.210.0120.00316.85
7.4.200.0070.00016.85
7.4.160.0030.01316.87
7.4.150.0150.00617.40
7.4.140.0120.00817.86
7.4.130.0080.01116.72
7.4.120.0110.00916.65
7.4.110.0140.00416.65
7.4.100.0210.00316.81
7.4.90.0090.01217.03
7.4.80.0130.01019.39
7.4.70.0030.01616.77
7.4.60.0070.01016.77
7.4.50.0040.00416.54
7.4.40.0040.01216.69
7.4.30.0040.01816.73
7.4.00.0030.01515.19
7.3.330.0050.00013.33
7.3.320.0000.00613.45
7.3.310.0030.00316.54
7.3.300.0000.00716.48
7.3.290.0090.00716.48
7.3.280.0100.00916.46
7.3.270.0170.00017.40
7.3.260.0120.00616.67
7.3.250.0100.00816.66
7.3.240.0060.01116.64
7.3.230.0090.00916.57
7.3.210.0090.00916.82
7.3.200.0100.00619.39
7.3.190.0090.00616.79
7.3.180.0100.00716.57
7.3.170.0120.01016.84
7.3.160.0070.01016.60
7.2.330.0090.00916.82
7.2.320.0030.01416.94
7.2.310.0040.01517.09
7.2.300.0120.00616.73
7.2.290.0190.00616.78
7.2.60.0000.01316.82
7.2.00.0030.00919.58
7.1.200.0060.00616.02
7.1.100.0000.01218.44
7.1.70.0000.00817.41
7.1.60.0130.00719.46
7.1.50.0170.02334.73
7.1.00.0030.07722.54
7.0.200.0030.00617.11
7.0.140.0000.05322.08
7.0.90.0130.05719.98
7.0.80.0030.04719.92
7.0.70.0100.09019.95
7.0.60.0130.04019.97
7.0.50.0170.06020.40
7.0.40.0070.07020.11
7.0.30.0100.06020.09
7.0.20.0070.08320.16
7.0.10.0030.08319.99
7.0.00.0070.08020.12
5.6.280.0000.07721.07
5.6.240.0070.07020.54
5.6.230.0000.05320.61
5.6.220.0030.08320.66
5.6.210.0130.07720.65
5.6.200.0030.09021.05
5.6.190.0100.08021.09
5.6.180.0100.08021.08
5.6.170.0130.03321.04
5.6.160.0070.04021.09
5.6.150.0070.07020.96
5.6.140.0100.07321.07
5.6.130.0000.06021.09
5.6.120.0070.08020.96
5.6.110.0070.08321.11
5.6.100.0130.06021.02
5.6.90.0030.05320.96
5.6.80.0070.04720.36
5.6.70.0230.06020.30
5.6.60.0100.07320.56
5.6.50.0100.04020.49
5.6.40.0070.07720.49
5.6.30.0070.06020.44
5.6.20.0030.04020.39
5.6.10.0000.04320.51
5.6.00.0030.04020.38
5.5.380.0130.08020.31
5.5.370.0000.04320.35
5.5.360.0070.07020.34
5.5.350.0070.08320.33
5.5.340.0230.07020.94
5.5.330.0100.08020.91
5.5.320.0100.04020.81
5.5.310.0130.06020.80
5.5.300.0130.07320.91
5.5.290.0130.07720.90
5.5.280.0030.08720.92
5.5.270.0100.06020.88
5.5.260.0130.07720.75
5.5.250.0000.08020.60
5.5.240.0170.07020.32
5.5.230.0030.05020.30
5.5.220.0030.07720.00
5.5.210.0000.07720.18
5.5.200.0170.06720.02
5.5.190.0000.07320.19
5.5.180.0030.04720.15
5.5.160.0100.03320.10
5.5.150.0170.05720.24
5.5.140.0100.03320.01
5.5.130.0000.04720.13
5.5.120.0100.03320.22
5.5.110.0200.02320.20
5.5.100.0000.05720.09
5.5.90.0030.03319.98
5.5.80.0130.05720.12
5.5.70.0030.04020.12
5.5.60.0000.05320.16
5.5.50.0030.03320.08
5.5.40.0070.05020.02
5.5.30.0070.04020.17
5.5.20.0000.04020.16
5.5.10.0030.04320.14
5.5.00.0070.03720.05
5.4.450.0030.08719.48
5.4.440.0000.07319.37
5.4.430.0070.08019.56
5.4.420.0070.04319.35
5.4.410.0070.06719.02
5.4.400.0030.08019.04
5.4.390.0100.07719.13
5.4.380.0100.07318.89
5.4.370.0100.05019.04
5.4.360.0070.05319.05
5.4.350.0030.05018.88
5.4.340.0030.04019.09
5.4.320.0030.05719.22
5.4.310.0030.04019.05
5.4.300.0030.03719.12
5.4.290.0030.03719.22
5.4.280.0070.04719.04
5.4.270.0100.07019.11
5.4.260.0030.04018.84
5.4.250.0070.03319.11
5.4.240.0030.04319.11
5.4.230.0000.03718.86
5.4.220.0000.04318.89
5.4.210.0100.04719.11
5.4.200.0070.03319.20
5.4.190.0030.04319.23
5.4.180.0000.04018.86
5.4.170.0030.08019.03
5.4.160.0000.03319.14
5.4.150.0030.03318.85
5.4.140.0170.02316.51
5.4.130.0030.03316.46
5.4.120.0070.06016.38
5.4.110.0100.05016.54
5.4.100.0030.06016.56
5.4.90.0000.07716.44
5.4.80.0000.04016.46
5.4.70.0030.06316.38
5.4.60.0100.06316.49
5.4.50.0070.07716.37
5.4.40.0070.07016.43
5.4.30.0000.07716.41
5.4.20.0030.07716.48
5.4.10.0030.07716.34
5.4.00.0030.07715.69
5.3.290.0030.04014.67
5.3.280.0030.07014.71
5.3.270.0000.04014.70
5.3.260.0100.03314.62
5.3.250.0030.03014.75
5.3.240.0030.03314.73
5.3.230.0100.06714.57
5.3.220.0000.06714.68
5.3.210.0070.07314.66
5.3.200.0100.07014.61
5.3.190.0030.05714.73
5.3.180.0030.03714.52
5.3.170.0030.03714.70
5.3.160.0030.06014.68
5.3.150.0070.07714.57
5.3.140.0000.08014.56
5.3.130.0100.06314.50
5.3.120.0030.07314.56
5.3.110.0000.06714.59
5.3.100.0070.04714.18
5.3.90.0130.03314.11
5.3.80.0070.06714.18
5.3.70.0100.07314.05
5.3.60.0030.07314.02
5.3.50.0100.06714.07
5.3.40.0030.07714.10
5.3.30.0070.07013.88
5.3.20.0000.05013.61
5.3.10.0030.03713.79
5.3.00.0070.07313.73
5.2.170.0000.06011.09
5.2.160.0030.04711.24
5.2.150.0000.06011.29
5.2.140.0070.06011.23
5.2.130.0000.05311.03
5.2.120.0030.06011.22
5.2.110.0030.03011.18
5.2.100.0030.04011.02
5.2.90.0030.04711.04
5.2.80.0030.03311.13
5.2.70.0030.06310.98
5.2.60.0070.05711.14
5.2.50.0130.04311.08
5.2.40.0130.04710.96
5.2.30.0070.03711.06
5.2.20.0100.05011.01
5.2.10.0000.06010.99
5.2.00.0030.06010.77
5.1.60.0030.05310.57
5.1.50.0000.05710.57
5.1.40.0000.03710.57
5.1.30.0070.04710.57
5.1.20.0000.05710.57
5.1.10.0100.04710.57
5.1.00.0070.05310.57
5.0.50.0030.03710.57
5.0.40.0030.04310.57
5.0.30.0030.06710.57
5.0.20.0100.03310.57
5.0.10.0030.03310.57
5.0.00.0030.06710.57
4.4.90.0000.02310.57
4.4.80.0030.03310.57
4.4.70.0100.01010.57
4.4.60.0070.01710.57
4.4.50.0000.03710.57
4.4.40.0030.04310.57
4.4.30.0000.03710.57
4.4.20.0070.03310.57
4.4.10.0000.02310.57
4.4.00.0000.02710.57
4.3.110.0000.03010.57
4.3.100.0030.03310.57
4.3.90.0000.02010.57
4.3.80.0070.04310.57
4.3.70.0000.01710.57
4.3.60.0000.03710.57
4.3.50.0030.03310.57
4.3.40.0000.05310.57
4.3.30.0030.02310.57
4.3.20.0030.03710.57
4.3.10.0000.03310.57
4.3.00.0000.03710.57

preferences:
54.12 ms | 400 KiB | 5 Q