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'))); $start_date = "{$year}-{$month}-01"; $end_date = date('Y-m-d', strtotime("+1 month", strtotime($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.70.0070.01117.13
8.3.60.0060.00916.75
8.3.50.0100.01022.05
8.3.40.0040.01119.05
8.3.30.0060.01018.92
8.3.20.0000.00821.04
8.3.10.0040.00421.76
8.3.00.0000.00817.88
8.2.190.0150.00416.75
8.2.180.0120.00316.88
8.2.170.0140.00722.96
8.2.160.0060.01320.39
8.2.150.0040.00424.18
8.2.140.0040.00424.66
8.2.130.0080.00018.22
8.2.120.0040.00426.35
8.2.110.0060.00320.56
8.2.100.0030.00918.09
8.2.90.0040.00418.09
8.2.80.0080.00018.34
8.2.70.0080.00018.05
8.2.60.0000.00817.88
8.2.50.0060.00618.10
8.2.40.0000.00920.59
8.2.30.0040.00419.34
8.2.20.0040.00418.23
8.2.10.0040.00418.21
8.2.00.0070.00018.14
8.1.280.0090.00625.92
8.1.270.0040.00422.19
8.1.260.0040.00426.35
8.1.250.0030.00628.09
8.1.240.0060.00621.00
8.1.230.0080.00320.96
8.1.220.0000.00817.79
8.1.210.0060.00318.89
8.1.200.0030.00517.60
8.1.190.0000.00817.48
8.1.180.0000.00818.10
8.1.170.0040.00420.64
8.1.160.0000.00719.06
8.1.150.0040.00420.26
8.1.140.0030.00519.73
8.1.130.0030.00619.16
8.1.120.0000.00817.76
8.1.110.0030.00617.68
8.1.100.0030.00617.70
8.1.90.0080.00017.71
8.1.80.0040.00417.74
8.1.70.0040.00417.77
8.1.60.0000.00817.78
8.1.50.0040.00417.76
8.1.40.0030.00517.70
8.1.30.0040.00417.85
8.1.20.0080.00017.72
8.1.10.0080.00017.70
8.1.00.0040.00417.83
8.0.300.0000.00720.28
8.0.290.0000.00717.13
8.0.280.0040.00418.68
8.0.270.0000.00717.34
8.0.260.0030.00317.33
8.0.250.0070.00017.32
8.0.240.0070.00017.28
8.0.230.0000.00717.30
8.0.220.0030.00417.06
8.0.210.0040.00417.26
8.0.200.0040.00417.19
8.0.190.0040.00417.33
8.0.180.0040.00417.34
8.0.170.0000.00717.27
8.0.160.0080.00017.18
8.0.150.0000.00817.09
8.0.140.0030.00417.12
8.0.130.0030.00313.66
8.0.120.0040.00417.18
8.0.110.0000.00717.16
8.0.100.0000.00717.20
8.0.90.0030.00617.16
8.0.80.0090.01217.29
8.0.70.0030.00517.27
8.0.60.0040.00417.25
8.0.50.0000.00817.14
8.0.30.0090.01017.27
8.0.20.0120.00717.46
8.0.10.0000.00717.32
8.0.00.0130.00416.82
7.4.330.0030.00315.55
7.4.320.0050.00216.83
7.4.300.0000.00616.72
7.4.290.0030.00316.71
7.4.280.0070.00016.63
7.4.270.0040.00416.68
7.4.260.0050.00516.81
7.4.250.0040.00416.70
7.4.240.0070.00016.75
7.4.230.0000.00716.66
7.4.220.0130.00616.78
7.4.210.0030.01016.77
7.4.200.0000.00716.89
7.4.160.0090.00716.84
7.4.150.0060.01217.40
7.4.140.0070.01517.86
7.4.130.0070.00916.80
7.4.120.0100.00816.69
7.4.110.0060.01116.87
7.4.100.0140.00316.69
7.4.90.0100.01316.83
7.4.80.0110.00719.39
7.4.70.0060.01216.72
7.4.60.0090.00616.85
7.4.50.0040.01216.89
7.4.40.0090.00916.70
7.4.30.0090.00916.77
7.4.00.0070.00715.07
7.3.330.0060.00013.61
7.3.320.0030.00313.64
7.3.310.0000.00716.46
7.3.300.0000.00716.63
7.3.290.0020.01316.63
7.3.280.0080.01116.64
7.3.270.0060.01217.40
7.3.260.0160.00716.73
7.3.250.0160.00516.65
7.3.240.0110.00716.73
7.3.230.0090.00616.63
7.3.210.0110.00716.96
7.3.200.0120.00416.66
7.3.190.0060.01016.76
7.3.180.0180.00316.64
7.3.170.0090.00816.63
7.3.160.0130.00716.72
7.2.330.0040.01516.73
7.2.320.0080.01016.83
7.2.310.0120.00416.79
7.2.300.0030.02016.78
7.2.290.0060.01216.81
7.2.60.0100.00716.84
7.1.200.0000.01116.16
7.1.70.0030.00317.34
7.1.60.0080.00317.30
7.1.00.0030.06022.47
7.0.200.0060.01016.88
7.0.140.0100.05322.01
7.0.130.0030.06021.98
7.0.120.0130.05022.05
7.0.110.0170.05022.13
7.0.100.0130.05322.00
7.0.90.0100.05721.98
7.0.80.0070.05722.13
7.0.70.0070.05722.12
7.0.60.0130.05722.10
7.0.50.0130.05322.20
7.0.40.0200.07322.00
7.0.30.0130.08022.20
7.0.20.0100.05722.19
7.0.10.0070.06021.98
7.0.00.0200.04321.99
5.6.290.0170.04720.79
5.6.280.0070.05721.07
5.6.270.0130.05320.97
5.6.260.0130.05321.14
5.6.250.0000.06321.09
5.6.240.0130.05320.86
5.6.230.0030.06321.13
5.6.220.0030.06020.87
5.6.210.0070.06721.10
5.6.200.0100.05720.91
5.6.190.0100.06320.74
5.6.180.0130.06720.79
5.6.170.0130.06320.86
5.6.160.0130.05320.89
5.6.150.0000.06720.89
5.6.140.0130.05720.92
5.6.130.0100.05721.03
5.6.120.0130.05721.03
5.6.110.0130.08021.05
5.6.100.0170.05321.03
5.6.90.0070.05720.87
5.6.80.0070.05320.45
5.6.70.0070.08020.20
5.6.60.0070.05720.46
5.6.50.0070.06020.40
5.6.40.0200.06020.39
5.6.30.0100.05320.21
5.6.20.0070.05720.45
5.6.10.0070.05320.21
5.6.00.0100.07020.45

preferences:
63.23 ms | 401 KiB | 5 Q