3v4l.org

run code in 300+ PHP versions simultaneously
<?php function getTimeRange($month) { $month = str_pad($month, 2, '0', STR_PAD_LEFT); $year = $month > date('m') ? date('Y') - 1 : date('Y'); $start_date = "{$year}-{$month}-01"; $end_date = date('Y-m-d', strtotime("+1 month", strtotime($start_date))); return array( 'start_date' => $start_date, 'end_date' => $end_date ); } function getTimeRange2($month, $year = 0) { $month = str_pad($month, 2, '0', STR_PAD_LEFT); $year = ($year ? : ($month > date('m') ? date('Y') - 1 : date('Y'))); $res = array( 'start_date' => "{$year}-{$month}-01", 'end_date' => date('Y-m-d', strtotime("+1 month", strtotime($res['start_date']))) ); return $res; } var_dump(getTimeRange(1)); var_dump(getTimeRange2(1));

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.0030.01316.97
8.3.50.0030.01218.30
8.3.40.0060.00918.93
8.3.30.0140.00718.68
8.3.20.0040.01120.86
8.3.10.0080.00021.85
8.3.00.0050.00317.88
8.2.180.0110.00717.25
8.2.170.0040.01122.96
8.2.160.0100.01020.52
8.2.150.0000.00824.18
8.2.140.0000.00824.66
8.2.130.0100.00718.15
8.2.120.0040.00426.35
8.2.110.0030.00621.04
8.2.100.0070.00418.03
8.2.90.0040.00418.09
8.2.80.0000.00918.34
8.2.70.0040.00418.05
8.2.60.0050.00318.00
8.2.50.0070.00718.10
8.2.40.0040.00420.72
8.2.30.0040.00419.55
8.2.20.0060.00318.28
8.2.10.0040.00418.30
8.2.00.0000.00817.96
8.1.280.0150.00725.92
8.1.270.0080.00022.10
8.1.260.0040.00426.35
8.1.250.0090.00028.09
8.1.240.0070.00321.30
8.1.230.0060.00620.97
8.1.220.0050.00317.79
8.1.210.0040.00418.87
8.1.200.0000.00817.48
8.1.190.0040.00417.48
8.1.180.0040.00418.10
8.1.170.0000.00820.80
8.1.160.0000.00818.92
8.1.150.0000.00720.36
8.1.140.0040.00419.65
8.1.130.0000.00919.01
8.1.120.0000.00717.73
8.1.110.0030.00517.73
8.1.100.0060.00317.79
8.1.90.0000.00817.64
8.1.80.0040.00417.77
8.1.70.0080.00017.66
8.1.60.0000.00817.80
8.1.50.0000.00817.76
8.1.40.0040.00417.76
8.1.30.0040.00417.86
8.1.20.0040.00417.80
8.1.10.0000.00917.70
8.1.00.0080.00017.64
8.0.300.0030.00620.23
8.0.290.0080.00017.13
8.0.280.0070.00018.51
8.0.270.0040.00417.33
8.0.260.0030.00317.41
8.0.250.0030.00317.35
8.0.240.0000.00717.27
8.0.230.0030.00317.32
8.0.220.0030.00317.17
8.0.210.0040.00417.31
8.0.200.0070.00017.24
8.0.190.0040.00417.31
8.0.180.0000.00817.22
8.0.170.0070.00017.25
8.0.160.0040.00417.20
8.0.150.0000.00717.20
8.0.140.0040.00417.13
8.0.130.0000.00613.52
8.0.120.0000.00817.14
8.0.110.0030.00317.13
8.0.100.0040.00417.18
8.0.90.0000.00817.31
8.0.80.0060.01517.29
8.0.70.0040.00417.23
8.0.60.0040.00417.10
8.0.50.0070.00017.23
8.0.30.0110.00717.47
8.0.20.0120.00617.40
8.0.10.0040.00417.16
8.0.00.0150.00817.20
7.4.330.0000.00615.55
7.4.320.0070.00016.84
7.4.300.0000.00716.82
7.4.290.0030.00516.73
7.4.280.0000.00816.78
7.4.270.0000.00816.84
7.4.260.0050.00316.61
7.4.250.0020.00516.71
7.4.240.0000.00716.66
7.4.230.0040.00416.91
7.4.220.0170.00716.86
7.4.210.0090.00616.77
7.4.200.0030.00316.86
7.4.160.0070.00816.73
7.4.150.0150.00417.40
7.4.140.0070.01317.86
7.4.130.0100.01016.75
7.4.120.0120.00817.00
7.4.110.0070.01716.74
7.4.100.0090.01216.74
7.4.90.0180.00316.71
7.4.80.0070.01019.39
7.4.70.0130.00316.77
7.4.60.0030.01316.92
7.4.50.0110.00416.51
7.4.40.0100.01316.70
7.4.30.0080.00816.61
7.4.00.0060.01215.29
7.3.330.0030.00313.63
7.3.320.0030.00313.56
7.3.310.0040.00416.67
7.3.300.0070.00016.61
7.3.290.0030.01216.64
7.3.280.0130.00716.64
7.3.270.0060.01117.40
7.3.260.0160.01016.76
7.3.250.0030.01616.65
7.3.240.0100.01016.70
7.3.230.0120.00416.71
7.3.210.0140.00316.81
7.3.200.0140.00316.95
7.3.190.0100.01016.56
7.3.180.0120.00916.68
7.3.170.0030.01616.73
7.3.160.0070.01616.85
7.3.10.0120.00616.59
7.3.00.0100.00717.10
7.2.330.0070.01117.09
7.2.320.0170.00317.11
7.2.310.0130.00316.96
7.2.300.0120.01216.61
7.2.290.0080.00916.83
7.2.130.0000.01717.30
7.2.120.0040.00717.06
7.2.110.0040.01117.22
7.2.100.0110.00417.21
7.2.90.0060.00616.93
7.2.80.0030.00617.18
7.2.70.0040.01117.00
7.2.60.0090.00617.26
7.2.50.0040.00816.91
7.2.40.0030.01516.87
7.2.30.0130.00316.86
7.2.20.0040.00717.15
7.2.10.0030.00716.98
7.2.00.0040.00717.19
7.1.250.0030.01015.91
7.1.240.0040.00715.65
7.1.230.0070.00715.76
7.1.220.0030.01015.81
7.1.210.0030.01016.09
7.1.200.0070.00716.10
7.1.190.0040.01116.14
7.1.180.0070.00716.13
7.1.170.0090.00616.00
7.1.160.0070.00715.75
7.1.150.0030.01316.01
7.1.140.0000.01316.06
7.1.130.0000.01315.68
7.1.120.0000.01315.84
7.1.110.0050.00515.94
7.1.100.0070.00716.17
7.1.90.0100.00715.95
7.1.80.0040.00416.23
7.1.70.0030.00616.76
7.1.60.0070.00516.66
7.1.50.0030.01316.18
7.1.40.0030.00916.13
7.1.30.0080.00616.03
7.1.20.0060.00616.13
7.1.10.0060.00316.03
7.1.00.0050.04019.33
7.0.330.0030.00715.69
7.0.320.0060.01015.57
7.0.310.0110.00615.32
7.0.300.0000.00915.40
7.0.290.0030.00615.43
7.0.280.0090.00415.57
7.0.270.0090.00915.30
7.0.260.0040.01215.53
7.0.250.0120.00315.55
7.0.240.0060.00915.59
7.0.230.0030.01315.50
7.0.220.0030.01015.54
7.0.210.0030.00915.28
7.0.200.0080.00516.13
7.0.190.0030.00915.71
7.0.180.0090.00315.32
7.0.170.0040.01115.50
7.0.160.0000.00915.67
7.0.150.0070.00715.49
7.0.140.0070.03318.82
7.0.130.0020.04518.81
7.0.120.0050.03018.97
7.0.110.0090.03118.70
7.0.100.0070.03018.79
7.0.90.0080.03218.77
7.0.80.0080.03118.76
7.0.70.0070.03318.90
7.0.60.0090.03218.72
7.0.50.0060.03118.87
7.0.40.0050.03017.87
7.0.30.0050.04017.86
7.0.20.0140.03717.86
7.0.10.0050.03517.71
7.0.00.0050.04117.84
5.6.380.0070.00714.48
5.6.370.0070.01014.75
5.6.360.0030.01314.33
5.6.350.0100.00614.48
5.6.340.0080.00314.59
5.6.330.0040.01214.46
5.6.320.0040.01114.17
5.6.310.0090.00014.33
5.6.300.0040.01114.79
5.6.290.0070.03717.69
5.6.280.0070.03417.54
5.6.270.0070.03017.60
5.6.260.0050.03517.70
5.6.250.0070.03617.80
5.6.240.0130.02717.62
5.6.230.0060.03617.82
5.6.220.0080.03217.60
5.6.210.0110.02917.57
5.6.200.0040.03817.68
5.6.190.0070.04317.51
5.6.180.0020.04717.75
5.6.170.0100.02817.70
5.6.160.0050.03717.89
5.6.150.0110.03717.75
5.6.140.0030.03717.67
5.6.130.0070.03317.63
5.6.120.0120.03017.79
5.6.110.0130.02717.94
5.6.100.0110.03717.62
5.6.90.0030.03617.75
5.6.80.0090.03017.44
5.6.70.0050.03317.52
5.6.60.0150.03217.37
5.6.50.0120.02617.37
5.6.40.0100.02717.29
5.6.30.0060.03117.37
5.6.20.0070.03317.49
5.6.10.0060.02817.31
5.6.00.0070.03017.29

preferences:
54.2 ms | 400 KiB | 5 Q