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(_getYTDMonths(2015));

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.0090.00918.75
8.3.50.0120.01022.11
8.3.40.0100.01019.13
8.3.30.0100.01019.17
8.3.20.0080.00020.21
8.3.10.0080.00021.90
8.3.00.0040.00419.19
8.2.180.0040.01416.88
8.2.170.0120.00622.96
8.2.160.0140.00022.26
8.2.150.0000.00824.18
8.2.140.0080.00024.66
8.2.130.0040.00426.16
8.2.120.0060.00319.79
8.2.110.0060.00320.65
8.2.100.0060.00618.02
8.2.90.0030.00518.00
8.2.80.0040.00417.97
8.2.70.0070.00718.30
8.2.60.0050.00318.16
8.2.50.0080.00018.10
8.2.40.0000.01320.20
8.2.30.0030.00718.25
8.2.20.0000.00818.13
8.2.10.0090.00018.34
8.2.00.0040.00418.16
8.1.280.0120.00625.92
8.1.270.0060.00319.07
8.1.260.0030.00526.35
8.1.250.0050.00328.09
8.1.240.0080.00023.95
8.1.230.0030.00719.16
8.1.220.0000.00817.91
8.1.210.0030.00518.77
8.1.200.0000.01017.63
8.1.190.0070.00317.50
8.1.180.0040.00418.10
8.1.170.0030.00618.84
8.1.160.0000.00721.99
8.1.150.0000.00918.97
8.1.140.0000.00919.47
8.1.130.0000.00717.62
8.1.120.0040.00417.82
8.1.110.0050.00217.73
8.1.100.0040.00417.77
8.1.90.0070.00017.75
8.1.80.0050.00217.79
8.1.70.0000.00717.71
8.1.60.0030.00617.71
8.1.50.0030.00717.58
8.1.40.0040.00417.64
8.1.30.0030.00617.79
8.1.20.0000.00917.93
8.1.10.0050.00317.67
8.1.00.0030.00517.75
8.0.300.0060.00321.84
8.0.290.0050.00516.88
8.0.280.0040.00418.65
8.0.270.0030.00317.30
8.0.260.0000.00717.18
8.0.250.0070.00017.26
8.0.240.0070.00017.35
8.0.230.0000.00717.18
8.0.220.0030.00317.13
8.0.210.0050.00317.25
8.0.200.0060.00017.32
8.0.190.0060.00317.31
8.0.180.0080.00017.28
8.0.170.0040.00417.25
8.0.160.0040.00417.25
8.0.150.0000.00817.10
8.0.140.0070.00017.24
8.0.130.0000.00913.57
8.0.120.0040.00417.18
8.0.110.0040.00417.26
8.0.100.0000.00717.13
8.0.90.0000.00817.16
8.0.80.0160.00617.20
8.0.70.0000.00717.11
8.0.60.0000.00817.27
8.0.50.0040.00417.12
8.0.30.0110.01417.43
8.0.20.0120.01017.40
8.0.10.0000.00717.25
8.0.00.0120.00917.02
7.4.330.0000.00615.09
7.4.320.0040.00416.88
7.4.300.0000.00716.78
7.4.290.0000.00716.80
7.4.280.0030.00516.62
7.4.270.0070.00016.66
7.4.260.0060.00316.71
7.4.250.0070.00016.72
7.4.240.0020.00616.82
7.4.230.0030.00316.86
7.4.220.0070.02016.91
7.4.210.0040.01116.79
7.4.200.0050.00316.93
7.4.160.0120.00316.83
7.4.150.0090.00917.40
7.4.140.0090.01417.86
7.4.130.0130.00416.82
7.4.120.0070.01016.82
7.4.110.0090.01516.74
7.4.100.0110.00516.82
7.4.90.0070.01016.99
7.4.80.0210.00019.39
7.4.70.0110.00716.59
7.4.60.0140.00316.81
7.4.50.0080.00016.83
7.4.40.0150.00616.75
7.4.30.0040.01416.76
7.4.00.0100.00315.18
7.3.330.0030.00313.46
7.3.320.0000.00513.57
7.3.310.0070.00016.51
7.3.300.0000.00816.55
7.3.290.0090.00616.55
7.3.280.0080.00916.61
7.3.270.0040.01417.40
7.3.260.0070.01016.85
7.3.250.0100.01116.70
7.3.240.0150.00316.71
7.3.230.0000.01816.78
7.3.210.0140.00416.79
7.3.200.0100.00719.39
7.3.190.0080.00816.58
7.3.180.0070.01116.82
7.3.170.0030.01716.75
7.3.160.0100.00716.77
7.2.330.0120.00616.88
7.2.320.0120.00616.89
7.2.310.0170.00717.07
7.2.300.0130.00317.07
7.2.290.0080.01616.78
7.2.60.0030.00717.07
7.2.00.0000.00919.70
7.1.200.0070.00716.12
7.1.100.0060.00618.39
7.1.70.0120.00017.52
7.1.60.0070.01419.46
7.1.50.0290.01135.13
7.1.00.0070.07322.33
7.0.200.0030.00617.00
7.0.140.0070.05321.96
7.0.100.0000.04320.12
7.0.90.0070.09319.97
7.0.80.0130.07720.01
7.0.70.0170.04320.06
7.0.60.0270.04320.02
7.0.50.0470.07320.36
7.0.40.0070.08320.13
7.0.30.0070.04320.18
7.0.20.0000.04020.09
7.0.10.0070.03720.04
7.0.00.0030.07020.14
5.6.280.0030.07320.88
5.6.250.0030.03720.83
5.6.240.0100.06320.63
5.6.230.0000.04320.52
5.6.220.0070.06320.57
5.6.210.0000.05020.77
5.6.200.0030.08720.98
5.6.190.0000.06021.05
5.6.180.0030.05321.16
5.6.170.0130.06021.09
5.6.160.0070.08321.13
5.6.150.0070.03321.02
5.6.140.0100.04021.11
5.6.130.0070.05721.04
5.6.120.0000.08721.10
5.6.110.0030.08320.95
5.6.100.0030.08021.18
5.6.90.0030.08021.04
5.6.80.0030.05320.50
5.6.70.0100.08020.44
5.6.60.0070.08320.46
5.6.50.0170.07720.34
5.6.40.0130.06720.41
5.6.30.0130.04020.40
5.6.20.0070.07720.32
5.6.10.0100.08020.49
5.6.00.0070.04020.36
5.5.380.0100.07320.36
5.5.370.0070.06320.58
5.5.360.0100.03320.47
5.5.350.0000.08320.47
5.5.340.0070.04020.85
5.5.330.0070.08020.75
5.5.320.0030.04720.95
5.5.310.0000.04020.77
5.5.300.0100.06020.90
5.5.290.0000.04720.78
5.5.280.0030.07020.89
5.5.270.0070.08320.87
5.5.260.0070.08320.86
5.5.250.0070.08320.67
5.5.240.0030.04020.30
5.5.230.0070.05320.28
5.5.220.0070.04720.32
5.5.210.0030.08720.17
5.5.200.0000.08320.21
5.5.190.0030.08720.25
5.5.180.0270.06020.10
5.5.160.0100.06320.24
5.5.150.0130.07020.25
5.5.140.0070.07020.24
5.5.130.0200.07020.10
5.5.120.0030.06320.24
5.5.110.0030.07720.10
5.5.100.0070.06020.09
5.5.90.0070.08020.03
5.5.80.0030.08320.06
5.5.70.0070.07719.99
5.5.60.0000.06020.11
5.5.50.0030.07320.17
5.5.40.0100.04320.07
5.5.30.0000.08720.10
5.5.20.0170.07720.03
5.5.10.0130.07320.06
5.5.00.0100.05020.07
5.4.450.0030.08019.36
5.4.440.0070.08019.45
5.4.430.0070.08319.17
5.4.420.0030.06019.27
5.4.410.0000.05019.25
5.4.400.0030.03319.04
5.4.390.0130.07019.22
5.4.380.0130.06319.13
5.4.370.0030.05018.85
5.4.360.0170.07319.20
5.4.350.0000.04719.21
5.4.340.0130.04019.11
5.4.320.0100.04018.85
5.4.310.0030.07719.13
5.4.300.0170.06719.13
5.4.290.0170.04319.14
5.4.280.0030.05318.89
5.4.270.0070.07019.04
5.4.260.0070.05019.12
5.4.250.0070.08019.22
5.4.240.0130.06719.02
5.4.230.0030.04319.23
5.4.220.0100.03719.10
5.4.210.0130.07318.85
5.4.200.0070.05319.04
5.4.190.0070.07718.89
5.4.180.0070.08019.02
5.4.170.0100.05719.11
5.4.160.0100.04019.03
5.4.150.0030.05019.01
5.4.140.0030.04316.52
5.4.130.0030.04316.47
5.4.120.0100.07316.48
5.4.110.0070.07316.56
5.4.100.0070.04016.57
5.4.90.0000.03716.56
5.4.80.0030.05316.47
5.4.70.0030.03316.43
5.4.60.0030.06716.31
5.4.50.0030.03316.50
5.4.40.0000.03716.36
5.4.30.0070.05016.49
5.4.20.0070.06716.32
5.4.10.0070.07016.53
5.4.00.0030.04015.85
5.3.290.0130.07714.75
5.3.280.0030.07714.77
5.3.270.0100.06714.63
5.3.260.0070.05014.66
5.3.250.0170.05714.73
5.3.240.0030.04314.66
5.3.230.0030.07014.60
5.3.220.0070.05714.60
5.3.210.0000.06314.65
5.3.200.0030.04314.64
5.3.190.0030.09014.71
5.3.180.0070.05714.73
5.3.170.0030.03314.64
5.3.160.0070.06314.57
5.3.150.0030.03314.59
5.3.140.0130.03314.61
5.3.130.0130.05714.55
5.3.120.0070.03314.64
5.3.110.0070.08014.66
5.3.100.0100.06713.99
5.3.90.0130.06713.97
5.3.80.0070.07014.08
5.3.70.0070.05014.10
5.3.60.0170.06714.16
5.3.50.0100.07713.96
5.3.40.0070.07714.09
5.3.30.0070.07313.82
5.3.20.0130.06313.83
5.3.10.0100.06713.75
5.3.00.0070.07713.73
5.2.170.0100.03011.27
5.2.160.0100.06011.08
5.2.150.0030.05311.28
5.2.140.0030.05011.23
5.2.130.0070.04011.16
5.2.120.0030.06011.27
5.2.110.0100.03311.27
5.2.100.0100.05711.05
5.2.90.0100.04711.27
5.2.80.0130.05711.27
5.2.70.0070.04011.04
5.2.60.0100.05711.09
5.2.50.0000.05711.09
5.2.40.0000.06011.05
5.2.30.0100.06311.14
5.2.20.0070.06310.92
5.2.10.0070.05710.79
5.2.00.0070.06310.86
5.1.60.0030.05310.15
5.1.50.0030.0539.88
5.1.40.0070.05010.10
5.1.30.0030.02710.37
5.1.20.0170.04310.32
5.1.10.0000.03010.19
5.1.00.0070.0479.94
5.0.50.0030.0509.28
5.0.40.0000.0309.28
5.0.30.0070.0579.28
5.0.20.0000.0239.28
5.0.10.0030.0379.28
5.0.00.0030.0639.28
4.4.90.0100.0279.28
4.4.80.0000.0379.28
4.4.70.0070.0339.28
4.4.60.0000.0279.28
4.4.50.0000.0379.28
4.4.40.0030.0539.28
4.4.30.0030.0339.28
4.4.20.0000.0239.28
4.4.10.0000.0239.28
4.4.00.0030.0479.28
4.3.110.0030.0379.28
4.3.100.0100.0239.28
4.3.90.0000.0409.28
4.3.80.0030.0309.28
4.3.70.0030.0339.28
4.3.60.0000.0409.28
4.3.50.0030.0239.28
4.3.40.0000.0439.28
4.3.30.0000.0179.28
4.3.20.0000.0379.28
4.3.10.0000.0179.28
4.3.00.0070.0309.28

preferences:
63.83 ms | 401 KiB | 5 Q