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("-$i months")), 'monthName' => date('M', strtotime("-$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.0160.00318.48
8.3.50.0070.01118.16
8.3.40.0110.00419.07
8.3.30.0110.00419.26
8.3.20.0080.00020.34
8.3.10.0050.00321.90
8.3.00.0050.00318.96
8.2.180.0040.01116.75
8.2.170.0080.01622.96
8.2.160.0080.00522.25
8.2.150.0040.00424.18
8.2.140.0000.00824.66
8.2.130.0040.00426.16
8.2.120.0040.00419.79
8.2.110.0100.00022.33
8.2.100.0060.00618.16
8.2.90.0050.00319.38
8.2.80.0000.00918.00
8.2.70.0030.00518.00
8.2.60.0090.00018.15
8.2.50.0040.00418.07
8.2.40.0030.00618.41
8.2.30.0000.00818.27
8.2.20.0000.00918.05
8.2.10.0000.00818.14
8.2.00.0020.00517.98
8.1.280.0070.01425.92
8.1.270.0080.00019.13
8.1.260.0040.00426.35
8.1.250.0040.00428.09
8.1.240.0030.00724.04
8.1.230.0090.00319.07
8.1.220.0030.00617.77
8.1.210.0080.00018.77
8.1.200.0000.00917.63
8.1.190.0040.00417.50
8.1.180.0000.00818.10
8.1.170.0000.00818.91
8.1.160.0070.00022.04
8.1.150.0080.00018.96
8.1.140.0030.00619.49
8.1.130.0030.00318.00
8.1.120.0000.00717.75
8.1.110.0050.00317.64
8.1.100.0000.00717.81
8.1.90.0000.00717.75
8.1.80.0000.00717.77
8.1.70.0040.00417.73
8.1.60.0000.00917.74
8.1.50.0060.00317.74
8.1.40.0110.00017.75
8.1.30.0040.00417.89
8.1.20.0000.00817.84
8.1.10.0000.00717.78
8.1.00.0000.00817.84
8.0.300.0080.00018.77
8.0.290.0040.00417.13
8.0.280.0030.00318.48
8.0.270.0000.00717.41
8.0.260.0060.00017.50
8.0.250.0020.00517.36
8.0.240.0000.00717.27
8.0.230.0030.00317.29
8.0.220.0000.00717.28
8.0.210.0050.00217.14
8.0.200.0040.00417.37
8.0.190.0050.00317.35
8.0.180.0050.00317.30
8.0.170.0040.00417.26
8.0.160.0040.00417.23
8.0.150.0000.00817.21
8.0.140.0000.00817.26
8.0.130.0090.00013.64
8.0.120.0040.00417.24
8.0.110.0050.00317.20
8.0.100.0050.00217.18
8.0.90.0040.00417.29
8.0.80.0120.00817.25
8.0.70.0000.00717.16
8.0.60.0000.00717.30
8.0.50.0040.00417.27
8.0.30.0120.01117.39
8.0.20.0150.00617.52
8.0.10.0060.00317.25
8.0.00.0110.00816.93
7.4.330.0030.00315.09
7.4.320.0000.00716.72
7.4.300.0050.00216.83
7.4.290.0030.00316.87
7.4.280.0000.00716.80
7.4.270.0070.00016.78
7.4.260.0030.00616.71
7.4.250.0040.00416.71
7.4.240.0040.00416.80
7.4.230.0000.00716.71
7.4.220.0090.01616.85
7.4.210.0090.00616.83
7.4.200.0000.00716.81
7.4.160.0090.00616.77
7.4.150.0150.00917.40
7.4.140.0170.00717.86
7.4.130.0090.00916.71
7.4.120.0090.01116.72
7.4.110.0140.00416.80
7.4.100.0100.01316.92
7.4.90.0040.01416.70
7.4.80.0120.00619.39
7.4.70.0130.00916.88
7.4.60.0110.00616.80
7.4.50.0000.00816.46
7.4.40.0030.01716.71
7.4.30.0090.01516.80
7.4.00.0080.01015.38
7.3.330.0000.00713.37
7.3.320.0000.00513.43
7.3.310.0030.00316.45
7.3.300.0070.00016.50
7.3.290.0040.00216.45
7.3.280.0090.00916.59
7.3.270.0100.00717.40
7.3.260.0110.00616.74
7.3.250.0060.01116.75
7.3.240.0100.01416.63
7.3.230.0090.00916.75
7.3.210.0070.01016.56
7.3.200.0070.01019.39
7.3.190.0100.00716.96
7.3.180.0090.01616.63
7.3.170.0090.01216.57
7.3.160.0100.00716.74
7.3.120.0000.01914.80
7.3.110.0090.00615.13
7.3.100.0070.01314.90
7.3.90.0030.00915.10
7.3.80.0080.00415.34
7.3.70.0070.00714.84
7.3.60.0000.01014.84
7.3.50.0060.00615.21
7.3.40.0030.00715.20
7.3.30.0080.00414.93
7.3.20.0070.00716.87
7.3.10.0040.01116.81
7.3.00.0120.00316.89
7.2.330.0090.00917.12
7.2.320.0140.00317.06
7.2.310.0080.00817.13
7.2.300.0220.00017.04
7.2.290.0180.00616.88
7.2.250.0070.01115.35
7.2.240.0070.01115.63
7.2.230.0030.00915.64
7.2.220.0120.00315.60
7.2.210.0080.00315.52
7.2.200.0000.01515.52
7.2.190.0030.00615.42
7.2.180.0060.01015.26
7.2.170.0060.00915.53
7.2.160.0090.00615.51
7.2.150.0140.00317.26
7.2.140.0150.00017.27
7.2.130.0070.00716.89
7.2.120.0060.00917.11
7.2.110.0030.01017.30
7.2.100.0000.01317.07
7.2.90.0080.00417.22
7.2.80.0100.00717.20
7.2.70.0000.01416.98
7.2.60.0030.00817.11
7.2.50.0100.00717.33
7.2.40.0090.00317.31
7.2.30.0040.00917.14
7.2.20.0060.00917.24
7.2.10.0080.00317.14
7.2.00.0050.00918.38
7.1.330.0100.00615.93
7.1.320.0040.01116.14
7.1.310.0000.00916.15
7.1.300.0080.00315.63
7.1.290.0090.00615.84
7.1.280.0030.01016.09
7.1.270.0090.00615.87
7.1.260.0000.01316.21
7.1.250.0020.01215.94
7.1.240.0030.01015.96
7.1.230.0080.00416.05
7.1.220.0120.00316.12
7.1.210.0080.00616.19
7.1.200.0030.00616.02
7.1.190.0090.00616.17
7.1.180.0100.00716.23
7.1.170.0030.01215.99
7.1.160.0100.00315.69
7.1.150.0090.00615.79
7.1.140.0000.01315.93
7.1.130.0110.00315.86
7.1.120.0030.00716.08
7.1.110.0030.01216.02
7.1.100.0050.00917.07
7.1.90.0000.01116.20
7.1.80.0050.00515.64
7.1.70.0040.01016.81
7.1.60.0030.01317.77
7.1.50.0140.01225.65
7.1.40.0000.01416.08
7.1.30.0100.00315.95
7.1.20.0000.01515.97
7.1.10.0100.00316.00
7.1.00.0090.04019.20
7.0.330.0040.00815.62
7.0.320.0070.00315.46
7.0.310.0090.00015.73
7.0.300.0070.00715.50
7.0.290.0000.01115.48
7.0.280.0050.00515.50
7.0.270.0030.01015.60
7.0.260.0000.01315.32
7.0.250.0070.01115.40
7.0.240.0090.00615.79
7.0.230.0090.00015.68
7.0.220.0070.00715.29
7.0.210.0100.00315.51
7.0.200.0450.00315.32
7.0.190.0060.00815.80
7.0.180.0000.00815.52
7.0.170.0030.00915.42
7.0.160.0100.00315.65
7.0.150.0030.01415.46
7.0.140.0020.03218.87
7.0.130.0070.00715.63
7.0.120.0060.00615.81
7.0.110.0090.00615.64
7.0.100.0090.00315.56
7.0.90.0120.02717.94
7.0.80.0310.02317.80
7.0.70.0070.04417.72
7.0.60.0070.04317.79
7.0.50.0120.04218.06
7.0.40.0080.03516.75
7.0.30.0060.02616.82
7.0.20.0060.03116.91
7.0.10.0070.03316.73
7.0.00.0090.03016.81
5.6.400.0060.01014.91
5.6.390.0030.00614.70
5.6.380.0060.01214.68
5.6.370.0000.01314.68
5.6.360.0100.00314.71
5.6.350.0110.00314.91
5.6.340.0070.00714.68
5.6.330.0040.01414.56
5.6.320.0080.00814.73
5.6.310.0030.00914.51
5.6.300.0000.01814.55
5.6.290.0030.01314.41
5.6.280.0030.04317.83
5.6.270.0070.00714.38
5.6.260.0030.00614.46
5.6.250.0090.00614.58
5.6.240.0090.04017.71
5.6.230.0060.02617.62
5.6.220.0050.04317.63
5.6.210.0030.04717.56
5.6.200.0070.04617.90
5.6.190.0100.04217.77
5.6.180.0020.04617.87
5.6.170.0030.02817.80
5.6.160.0020.02817.76
5.6.150.0050.04917.79
5.6.140.0070.02717.71
5.6.130.0050.03217.95
5.6.120.0140.03617.87
5.6.110.0080.03517.87
5.6.100.0090.04017.87
5.6.90.0050.02317.69
5.6.80.0050.02717.52
5.6.70.0060.02617.63
5.6.60.0060.02517.39
5.6.50.0030.04117.58
5.6.40.0100.02217.64
5.6.30.0030.04817.40
5.6.20.0110.01817.48
5.6.10.0030.02717.58
5.6.00.0170.03217.50
5.5.380.0080.04317.44
5.5.370.0080.02817.54
5.5.360.0080.04617.60
5.5.350.0120.03817.64
5.5.340.0080.04217.72
5.5.330.0030.04917.63
5.5.320.0100.03317.76
5.5.310.0070.04317.63
5.5.300.0100.03717.83
5.5.290.0110.04317.71
5.5.280.0080.03217.77
5.5.270.0020.03017.74
5.5.260.0050.04217.75
5.5.250.0040.02617.47
5.5.240.0020.02717.36
5.5.230.0040.02517.30
5.5.220.0050.02417.39
5.5.210.0030.02117.27
5.5.200.0050.02317.25
5.5.190.0100.02717.48
5.5.180.0020.05017.29
5.5.170.0070.00714.49
5.5.160.0080.03617.41
5.5.150.0030.03517.36
5.5.140.0080.02217.22
5.5.130.0020.02317.30
5.5.120.0020.02617.33
5.5.110.0080.02017.35
5.5.100.0090.02217.43
5.5.90.0050.02217.36
5.5.80.0020.02117.40
5.5.70.0080.01817.12
5.5.60.0050.02317.21
5.5.50.0020.03217.19
5.5.40.0020.02717.02
5.5.30.0070.02017.18
5.5.20.0040.02417.31
5.5.10.0030.02517.06
5.5.00.0070.02217.23
5.4.450.0030.02615.60
5.4.440.0100.02615.65
5.4.430.0030.04215.57
5.4.420.0030.02815.51
5.4.410.0020.02515.52
5.4.400.0060.02315.43
5.4.390.0050.02215.33
5.4.380.0030.02615.49
5.4.370.0050.01915.42
5.4.360.0050.02015.43
5.4.350.0050.01715.33
5.4.340.0050.02115.43
5.4.330.0030.00711.81
5.4.320.0030.02315.34
5.4.310.0030.02115.49
5.4.300.0080.03015.42
5.4.290.0060.01815.49
5.4.280.0050.02215.42
5.4.270.0050.02215.42
5.4.260.0040.03015.46
5.4.250.0040.02215.53
5.4.240.0090.01515.48
5.4.230.0050.02215.47
5.4.220.0030.02415.50
5.4.210.0060.02315.46
5.4.200.0030.02315.46
5.4.190.0020.02315.50
5.4.180.0050.02115.37
5.4.170.0020.02015.50
5.4.160.0050.02015.42
5.4.150.0050.02215.47
5.4.140.0090.02414.18
5.4.130.0040.02114.16
5.4.120.0040.01614.15
5.4.110.0050.01714.12
5.4.100.0020.01814.17
5.4.90.0100.01814.13
5.4.80.0020.02014.12
5.4.70.0020.02214.16
5.4.60.0030.03314.08
5.4.50.0030.01714.17
5.4.40.0070.03014.17
5.4.30.0040.02114.13
5.4.20.0050.02714.15
5.4.10.0100.03714.16
5.4.00.0050.03113.73
5.3.290.0130.06714.80
5.3.280.0000.04314.69
5.3.270.0030.03714.56
5.3.260.0000.04014.55
5.3.250.0100.03314.62
5.3.240.0070.03714.70
5.3.230.0030.04014.61
5.3.220.0030.04014.73
5.3.210.0070.02714.59
5.3.200.0030.03714.68
5.3.190.0030.03014.65
5.3.180.0000.03714.66
5.3.170.0000.03314.72
5.3.160.0070.03714.53
5.3.150.0070.03314.64
5.3.140.0000.03314.60
5.3.130.0070.03014.55
5.3.120.0000.03314.68
5.3.110.0000.06014.63
5.3.100.0000.04314.12
5.3.90.0000.08014.10
5.3.80.0070.06014.09
5.3.70.0030.03314.02
5.3.60.0000.05714.10
5.3.50.0100.05713.89
5.3.40.0070.03014.08
5.3.30.0100.05714.00
5.3.20.0030.03313.72
5.3.10.0070.07313.80
5.3.00.0100.07013.60
5.2.170.0070.02311.21
5.2.160.0030.02711.30
5.2.150.0100.05311.28
5.2.140.0070.05711.29
5.2.130.0000.06711.24
5.2.120.0030.06711.18
5.2.110.0030.06011.19
5.2.100.0030.06711.18
5.2.90.0000.06011.27
5.2.80.0030.06711.21
5.2.70.0030.04711.16
5.2.60.0070.06010.97
5.2.50.0070.06310.96
5.2.40.0070.06011.05
5.2.30.0070.05710.99
5.2.20.0030.03310.89
5.2.10.0070.04710.81
5.2.00.0030.04010.78
5.1.60.0030.05310.29
5.1.50.0070.04310.29
5.1.40.0000.05010.29
5.1.30.0030.05710.30
5.1.20.0130.03710.53
5.1.10.0000.06010.29
5.1.00.0030.03010.29
5.0.50.0170.03310.29
5.0.40.0070.03010.29
5.0.30.0000.07010.29
5.0.20.0030.04710.29
5.0.10.0100.03310.29
5.0.00.0030.07010.29
4.4.90.0030.03710.29
4.4.80.0000.03710.29
4.4.70.0070.03010.29
4.4.60.0070.03310.29
4.4.50.0070.02710.29
4.4.40.0030.05010.29
4.4.30.0000.02310.29
4.4.20.0070.03010.29
4.4.10.0100.02710.29
4.4.00.0000.05310.29
4.3.110.0000.02310.29
4.3.100.0030.03310.29
4.3.90.0000.03710.29
4.3.80.0030.05710.29
4.3.70.0030.03010.29
4.3.60.0030.03710.29
4.3.50.0000.03310.29
4.3.40.0000.02710.29
4.3.30.0000.03310.29
4.3.20.0000.02710.29
4.3.10.0000.03310.29
4.3.00.0000.03010.29

preferences:
74.11 ms | 400 KiB | 5 Q