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($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.0150.00616.88
8.3.50.0140.00522.18
8.3.40.0090.00619.05
8.3.30.0140.00719.05
8.3.20.0050.00320.92
8.3.10.0080.00021.89
8.3.00.0040.00417.88
8.2.180.0120.00317.25
8.2.170.0070.00722.96
8.2.160.0110.00720.38
8.2.150.0080.00024.18
8.2.140.0050.00324.66
8.2.130.0040.00426.16
8.2.120.0040.00421.11
8.2.110.0060.00621.18
8.2.100.0080.00418.16
8.2.90.0040.00418.28
8.2.80.0040.00418.28
8.2.70.0000.00818.05
8.2.60.0050.00317.88
8.2.50.0060.00618.10
8.2.40.0080.00020.71
8.2.30.0070.00019.51
8.2.20.0070.00018.25
8.2.10.0040.00418.27
8.2.00.0040.00418.09
8.1.280.0040.01425.92
8.1.270.0030.00522.18
8.1.260.0000.00726.35
8.1.250.0000.00728.09
8.1.240.0130.00320.52
8.1.230.0080.00321.04
8.1.220.0000.00817.90
8.1.210.0040.00418.77
8.1.200.0000.00817.60
8.1.190.0040.00417.50
8.1.180.0040.00418.10
8.1.170.0080.00020.74
8.1.160.0000.00818.92
8.1.150.0070.00020.32
8.1.140.0000.00819.64
8.1.130.0070.00019.11
8.1.120.0070.00017.71
8.1.110.0000.00717.65
8.1.100.0030.00617.62
8.1.90.0080.00017.81
8.1.80.0050.00317.70
8.1.70.0030.00317.76
8.1.60.0000.00717.82
8.1.50.0080.00017.76
8.1.40.0050.00317.61
8.1.30.0000.00817.88
8.1.20.0030.00617.79
8.1.10.0060.00317.82
8.1.00.0060.00317.77
8.0.300.0040.00420.07
8.0.290.0040.00417.25
8.0.280.0000.00718.61
8.0.270.0050.00317.41
8.0.260.0030.00317.45
8.0.250.0040.00417.25
8.0.240.0000.00717.32
8.0.230.0030.00317.17
8.0.220.0020.00517.17
8.0.210.0000.00717.15
8.0.200.0030.00317.23
8.0.190.0000.00717.21
8.0.180.0040.00417.29
8.0.170.0000.00717.30
8.0.160.0080.00017.34
8.0.150.0000.00817.19
8.0.140.0050.00217.10
8.0.130.0030.00313.57
8.0.120.0070.00017.23
8.0.110.0000.00717.30
8.0.100.0000.00717.15
8.0.90.0030.00517.11
8.0.80.0140.00317.11
8.0.70.0070.00017.22
8.0.60.0040.00417.08
8.0.50.0040.00417.23
8.0.30.0150.00517.38
8.0.20.0100.01017.47
8.0.10.0050.00317.35
8.0.00.0090.01317.29
7.4.330.0060.00015.55
7.4.320.0040.00416.84
7.4.300.0000.00616.80
7.4.290.0050.00316.84
7.4.280.0030.00616.81
7.4.270.0000.00716.73
7.4.260.0000.00716.78
7.4.250.0000.00716.74
7.4.240.0000.00716.75
7.4.230.0030.00316.81
7.4.220.0070.01116.86
7.4.210.0040.01116.79
7.4.200.0070.00016.75
7.4.160.0090.00716.74
7.4.150.0120.00417.40
7.4.140.0120.01117.86
7.4.130.0100.00916.74
7.4.120.0140.00616.67
7.4.110.0040.01516.69
7.4.100.0090.00916.66
7.4.90.0120.00616.72
7.4.80.0120.00919.39
7.4.70.0100.00716.86
7.4.60.0160.00016.86
7.4.50.0060.00916.69
7.4.40.0070.01216.76
7.4.30.0130.00317.02
7.4.00.0050.01215.20
7.3.330.0000.00613.65
7.3.320.0030.00313.71
7.3.310.0040.00416.56
7.3.300.0050.00316.69
7.3.290.0080.00916.63
7.3.280.0090.00816.64
7.3.270.0110.00817.40
7.3.260.0090.01616.77
7.3.250.0120.00716.84
7.3.240.0080.00916.79
7.3.230.0060.01016.61
7.3.210.0130.00416.73
7.3.200.0120.00616.94
7.3.190.0100.00716.78
7.3.180.0040.01816.67
7.3.170.0070.01016.77
7.3.160.0080.01516.57
7.3.120.0060.00815.10
7.3.110.0100.00815.27
7.3.100.0120.00515.22
7.3.90.0080.00715.13
7.3.80.0060.00515.10
7.3.70.0050.00915.12
7.3.60.0040.00714.97
7.3.50.0050.00914.94
7.3.40.0030.01115.13
7.3.30.0050.00815.00
7.3.20.0060.00617.01
7.3.10.0040.00916.82
7.3.00.0020.01116.76
7.2.330.0130.01316.75
7.2.320.0140.00716.63
7.2.310.0050.01017.01
7.2.300.0120.01217.05
7.2.290.0030.01717.03
7.2.250.0140.00515.32
7.2.240.0050.01615.46
7.2.230.0080.00815.31
7.2.220.0050.01015.39
7.2.210.0050.00915.28
7.2.200.0080.00615.04
7.2.190.0120.00315.27
7.2.180.0050.00715.23
7.2.170.0030.00915.37
7.2.160.0040.01115.43
7.2.150.0060.00617.02
7.2.140.0080.00417.14
7.2.130.0030.00617.01
7.2.120.0000.01317.13
7.2.110.0060.00917.21
7.2.100.0110.00316.91
7.2.90.0110.00417.08
7.2.80.0140.00517.25
7.2.70.0110.00417.13
7.2.60.0060.01016.87
7.2.50.0100.00717.07
7.2.40.0060.01016.92
7.2.30.0090.00617.01
7.2.20.0060.00917.21
7.2.10.0040.01217.27
7.2.00.0110.00416.87
7.1.330.0100.00816.00
7.1.320.0090.00715.99
7.1.310.0080.00616.09
7.1.300.0050.00715.73
7.1.290.0040.00615.97
7.1.280.0080.00615.89
7.1.270.0070.00215.81
7.1.260.0060.00815.86
7.1.250.0060.00616.09
7.1.240.0070.00716.02
7.1.230.0060.00815.95
7.1.220.0000.01415.80
7.1.210.0030.01015.86
7.1.200.0010.01315.96
7.1.190.0070.01116.09
7.1.180.0040.01216.13
7.1.170.0090.00916.15
7.1.160.0030.01216.07
7.1.150.0090.00615.91
7.1.140.0080.00816.04
7.1.130.0000.01316.09
7.1.120.0040.00815.64
7.1.110.0110.00416.19
7.1.100.0000.01316.13
7.1.90.0000.00916.20
7.1.80.0080.00315.81
7.1.70.0070.00516.83
7.1.60.0090.00416.89
7.1.50.0030.00616.17
7.1.40.0090.00316.09
7.1.30.0090.00315.83
7.1.20.0060.00915.93
7.1.10.0000.01515.83
7.1.00.0050.03219.24
7.0.330.0030.01015.37
7.0.320.0110.00015.58
7.0.310.0030.00915.63
7.0.300.0070.00415.23
7.0.290.0070.01015.29
7.0.280.0110.00415.37
7.0.270.0070.00715.31
7.0.260.0040.01115.27
7.0.250.0040.00815.45
7.0.240.0060.00615.59
7.0.230.0100.00715.66
7.0.220.0130.00315.45
7.0.210.0070.00715.61
7.0.200.0020.00916.15
7.0.190.0040.01115.42
7.0.180.0100.00315.63
7.0.170.0070.00315.43
7.0.160.0040.01115.88
7.0.150.0030.00915.31
7.0.140.0070.03018.91
7.0.130.0080.03118.86
7.0.120.0090.03018.77
7.0.110.0090.03018.86
7.0.100.0100.03118.88
7.0.90.0100.03018.91
7.0.80.0090.03118.62
7.0.70.0100.02818.82
7.0.60.0010.03618.67
7.0.50.0070.04318.78
7.0.40.0070.02917.87
7.0.30.0050.03317.83
7.0.20.0080.03017.82
7.0.10.0120.02717.78
7.0.00.0040.03917.85
5.6.400.0000.01114.48
5.6.390.0040.01214.50
5.6.380.0100.01014.32
5.6.370.0030.00614.09
5.6.360.0040.01114.54
5.6.350.0070.01014.50
5.6.340.0000.01414.67
5.6.330.0000.00914.47
5.6.320.0070.00414.46
5.6.310.0000.01514.68
5.6.300.0000.00914.33
5.6.290.0050.03517.52
5.6.280.0070.03417.88
5.6.270.0130.02817.88
5.6.260.0100.03117.85
5.6.250.0020.03817.71
5.6.240.0100.02917.56
5.6.230.0110.03117.89
5.6.220.0020.03717.76
5.6.210.0060.03417.53
5.6.200.0080.03317.59
5.6.190.0030.03617.67
5.6.180.0080.03017.58
5.6.170.0050.03517.68
5.6.160.0100.03517.67
5.6.150.0080.03317.74
5.6.140.0170.03317.54
5.6.130.0030.03817.74
5.6.120.0060.03517.57
5.6.110.0060.03117.73
5.6.100.0040.03617.70
5.6.90.0080.03217.60
5.6.80.0070.03117.20
5.6.70.0110.02817.22
5.6.60.0120.02817.27
5.6.50.0030.03517.26
5.6.40.0100.02917.41
5.6.30.0070.03117.25
5.6.20.0060.02817.29
5.6.10.0040.04217.33
5.6.00.0070.03517.36

preferences:
66.78 ms | 401 KiB | 5 Q