3v4l.org

run code in 300+ PHP versions simultaneously
<?php function period_to_timestamps($period) { switch($period) { case "last_7_days": $start = strtotime('-7 days'); $end = strtotime('now'); break; case "this_month": $start = strtotime('first day of this month'); $end = strtotime('now'); break; case "last_month": $start = strtotime('first day of last month'); $end = strtotime('last day of last month'); break; case "this_year": $start = strtotime('01-01-' . date('Y', strtotime('now'))); $end = strtotime('now'); break; case "last_year": $start = strtotime('01-01-' . date('Y', strtotime('now -1 year'))); $end = strtotime('12/31/' . date('Y', strtotime('now -1 year'))); break; default: $start = strtotime('now'); $end = strtotime('now'); } return array(date('m-d-Y', $start), date('m-d-Y', $end)); } var_dump(period_to_timestamps('last_7_days')); var_dump(period_to_timestamps('this_month')); var_dump(period_to_timestamps('last_month')); var_dump(period_to_timestamps('this_year')); var_dump(period_to_timestamps('last_year'));

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.0140.00016.50
8.3.50.0080.00822.10
8.3.40.0120.00318.84
8.3.30.0040.01119.20
8.3.20.0040.00420.16
8.3.10.0000.00823.53
8.3.00.0050.00320.77
8.2.180.0110.00718.34
8.2.170.0170.00322.96
8.2.160.0070.00720.11
8.2.150.0050.00324.18
8.2.140.0050.00324.66
8.2.130.0080.00026.16
8.2.120.0080.00021.04
8.2.110.0000.00922.23
8.2.100.0040.00819.89
8.2.90.0040.00419.42
8.2.80.0030.00618.00
8.2.70.0030.00617.75
8.2.60.0040.00417.93
8.2.50.0050.00518.07
8.2.40.0050.00319.94
8.2.30.0060.00318.26
8.2.20.0050.00317.90
8.2.10.0000.00818.29
8.2.00.0080.00017.89
8.1.280.0070.00725.92
8.1.270.0040.00424.09
8.1.260.0080.00026.35
8.1.250.0040.00428.09
8.1.240.0000.00924.02
8.1.230.0110.00019.09
8.1.220.0050.00317.77
8.1.210.0040.00418.77
8.1.200.0040.00417.60
8.1.190.0050.00317.47
8.1.180.0060.00319.39
8.1.170.0030.00618.73
8.1.160.0050.00322.09
8.1.150.0040.00418.95
8.1.140.0040.00417.72
8.1.130.0000.00717.88
8.1.120.0000.00717.73
8.1.110.0050.00317.63
8.1.100.0000.00717.63
8.1.90.0050.00317.75
8.1.80.0100.00017.75
8.1.70.0000.00717.61
8.1.60.0030.00617.80
8.1.50.0000.00817.52
8.1.40.0050.00317.79
8.1.30.0000.00917.86
8.1.20.0040.00417.82
8.1.10.0040.00417.63
8.1.00.0040.00417.71
8.0.300.0000.00718.77
8.0.290.0030.00617.30
8.0.280.0030.00318.59
8.0.270.0000.00817.40
8.0.260.0000.00617.34
8.0.250.0070.00017.23
8.0.240.0030.00617.30
8.0.230.0040.00417.19
8.0.220.0000.00817.21
8.0.210.0000.00717.16
8.0.200.0030.00317.16
8.0.190.0000.00817.27
8.0.180.0000.00717.22
8.0.170.0040.00417.06
8.0.160.0050.00217.16
8.0.150.0050.00317.04
8.0.140.0000.00717.14
8.0.130.0050.00013.54
8.0.120.0030.00617.15
8.0.110.0040.00417.08
8.0.100.0040.00416.96
8.0.90.0040.00417.04
8.0.80.0070.01417.21
8.0.70.0030.00517.23
8.0.60.0050.00217.18
8.0.50.0030.00517.05
8.0.30.0090.01117.41
8.0.20.0100.00917.41
8.0.10.0040.00417.26
8.0.00.0050.01517.00
7.4.330.0060.00015.21
7.4.320.0060.00016.67
7.4.300.0000.00616.71
7.4.290.0000.00716.72
7.4.280.0030.00316.72
7.4.270.0000.00816.82
7.4.260.0000.00716.73
7.4.250.0050.00316.79
7.4.240.0000.00816.65
7.4.230.0030.00416.71
7.4.220.0130.00916.66
7.4.210.0080.00616.78
7.4.200.0030.00316.79
7.4.190.0080.00016.96
7.4.160.0080.00816.77
7.4.150.0120.00617.40
7.4.140.0110.00717.86
7.4.130.0080.01016.73
7.4.120.0120.00616.81
7.4.110.0080.01016.78
7.4.100.0080.01616.82
7.4.90.0090.01616.69
7.4.80.0170.00419.39
7.4.70.0070.01016.65
7.4.60.0030.01416.59
7.4.50.0090.00016.74
7.4.40.0130.00316.63
7.4.30.0030.01416.64
7.4.00.0090.00615.27
7.3.330.0000.00613.45
7.3.320.0000.00513.51
7.3.310.0000.00716.48
7.3.300.0000.00716.40
7.3.290.0040.01516.46
7.3.280.0090.01216.42
7.3.270.0100.00817.40
7.3.260.0090.01416.70
7.3.250.0130.00716.60
7.3.240.0150.00616.45
7.3.230.0030.01416.78
7.3.210.0070.01016.49
7.3.200.0040.01919.39
7.3.190.0110.01116.37
7.3.180.0060.01316.50
7.3.170.0000.01816.48
7.3.160.0080.00816.50
7.3.120.0100.00615.07
7.2.330.0180.00017.07
7.2.320.0060.01916.67
7.2.310.0080.01216.95
7.2.300.0140.00816.95
7.2.290.0110.00816.80
7.2.60.0060.00617.26
7.1.200.0130.00015.76
7.1.100.0030.01018.41
7.1.70.0090.00017.28
7.1.60.0040.02119.46
7.1.50.0040.01217.13
7.1.00.0100.07022.54
7.0.200.0060.00316.82
7.0.140.0130.06722.09
7.0.80.0100.06319.96
7.0.70.0370.06320.04
7.0.60.0570.06719.88
7.0.50.0230.08020.26
7.0.40.0030.08320.05
7.0.30.0070.08320.13
7.0.20.0030.09319.96
7.0.10.0070.08719.94
7.0.00.0030.04320.11
5.6.280.0000.07721.00
5.6.230.0070.08320.58
5.6.220.0070.04020.66
5.6.210.0130.08020.57
5.6.200.0070.06720.96
5.6.190.0030.08321.09
5.6.180.0030.04321.07
5.6.170.0070.03720.97
5.6.160.0030.05720.97
5.6.150.0030.05321.18
5.6.140.0000.05021.02
5.6.130.0070.07721.09
5.6.120.0030.08320.94
5.6.110.0100.03720.94
5.6.100.0170.03021.16
5.6.90.0030.10721.10
5.6.80.0030.07320.54
5.6.70.0070.07020.47
5.6.60.0030.05020.38
5.6.50.0030.04720.54
5.6.40.0000.06720.33
5.6.30.0030.05720.43
5.6.20.0000.04320.41
5.6.10.0070.04020.38
5.6.00.0100.07720.43
5.5.370.0130.07020.40
5.5.360.0100.04320.36
5.5.350.0070.08020.47
5.5.340.0130.08320.90
5.5.330.0030.06320.82
5.5.320.0030.04320.79
5.5.310.0070.08020.77
5.5.300.0030.08320.77
5.5.290.0100.07720.89
5.5.280.0100.05020.84
5.5.270.0070.08320.89
5.5.260.0100.04320.89
5.5.250.0030.05320.64
5.5.240.0100.05020.16
5.5.230.0070.08720.19
5.5.220.0070.04720.07
5.5.210.0130.04320.25
5.5.200.0070.06320.25
5.5.190.0030.04020.27
5.5.180.0030.08020.20
5.5.160.0100.06020.24
5.5.150.0000.08020.18
5.5.140.0070.05320.28
5.5.130.0100.07020.22
5.5.120.0100.08020.14
5.5.110.0100.08320.13
5.5.100.0100.07020.09
5.5.90.0100.07319.96
5.5.80.0030.06320.16
5.5.70.0130.07320.16
5.5.60.0100.08020.15
5.5.50.0130.06720.07
5.5.40.0170.07320.10
5.5.30.0130.07320.13
5.5.20.0130.05720.12
5.5.10.0100.06720.12
5.5.00.0130.03720.04
5.4.450.0100.03019.42
5.4.440.0130.03319.50
5.4.430.0100.08019.50
5.4.420.0030.08719.20
5.4.410.0030.07319.10
5.4.400.0170.06718.95
5.4.390.0070.04018.91
5.4.380.0030.06019.18
5.4.370.0070.05319.16
5.4.360.0070.04318.85
5.4.350.0170.06019.04
5.4.340.0030.07018.95
5.4.320.0030.05318.85
5.4.310.0100.07319.05
5.4.300.0070.06018.90
5.4.290.0030.08319.03
5.4.280.0100.05719.23
5.4.270.0170.06719.18
5.4.260.0030.04319.20
5.4.250.0000.05019.11
5.4.240.0130.07319.04
5.4.230.0070.07019.15
5.4.220.0070.07318.84
5.4.210.0100.07019.23
5.4.200.0030.04318.93
5.4.190.0000.07319.04
5.4.180.0130.05019.04
5.4.170.0070.06019.14
5.4.160.0070.07019.07
5.4.150.0070.03718.86
5.4.140.0070.03716.46
5.4.130.0000.04316.49
5.4.120.0070.04316.41
5.4.110.0030.07716.39
5.4.100.0000.03716.25
5.4.90.0030.04316.50
5.4.80.0070.03016.43
5.4.70.0100.03016.32
5.4.60.0070.03016.33
5.4.50.0070.03016.29
5.4.40.0030.03716.54
5.4.30.0030.03716.48
5.4.20.0000.04316.45
5.4.10.0030.03016.36
5.4.00.0000.04315.70
5.3.290.0070.06014.63
5.3.280.0100.03714.61
5.3.270.0100.05714.57
5.3.260.0000.04314.64
5.3.250.0100.03714.63
5.3.240.0070.04314.64
5.3.230.0070.03714.63
5.3.220.0070.07714.54
5.3.210.0000.06314.62
5.3.200.0200.06314.71
5.3.190.0030.07014.60
5.3.180.0100.02714.67
5.3.170.0030.04014.68
5.3.160.0070.03014.56
5.3.150.0030.04014.64
5.3.140.0070.04014.58
5.3.130.0030.03714.52
5.3.120.0070.03314.55
5.3.110.0000.03714.70
5.3.100.0030.03714.06
5.3.90.0070.03314.09
5.3.80.0030.04314.18
5.3.70.0030.04014.03
5.3.60.0000.04014.06
5.3.50.0070.03314.02
5.3.40.0000.04013.87
5.3.30.0070.03313.86
5.3.20.0000.03713.74
5.3.10.0030.03313.67
5.3.00.0000.06313.70
5.2.170.0100.02011.17
5.2.160.0000.03011.21
5.2.150.0030.03011.26
5.2.140.0000.03311.18
5.2.130.0000.03011.02
5.2.120.0100.02311.22
5.2.110.0030.02711.24
5.2.100.0000.03011.25
5.2.90.0000.03011.12
5.2.80.0000.03711.23
5.2.70.0030.02711.13
5.2.60.0100.02311.00
5.2.50.0030.02711.13
5.2.40.0030.02310.92
5.2.30.0000.03311.02
5.2.20.0000.03011.00
5.2.10.0030.02710.96
5.2.00.0030.02710.80
5.1.60.0100.01710.09
5.1.50.0030.02310.06
5.1.40.0070.02010.08
5.1.30.0000.03010.27
5.1.20.0070.02310.30
5.1.10.0030.02310.08
5.1.00.0030.02310.07
5.0.50.0000.0208.56
5.0.40.0070.0178.28
5.0.30.0000.0278.34
5.0.20.0000.0208.05
5.0.10.0000.0208.08
5.0.00.0000.0308.28
4.4.90.0000.0177.47
4.4.80.0030.0137.47
4.4.70.0000.0307.47
4.4.60.0030.0137.47
4.4.50.0000.0177.47
4.4.40.0030.0207.47
4.4.30.0030.0137.47
4.4.20.0000.0177.47
4.4.10.0000.0177.47
4.4.00.0000.0277.47
4.3.110.0030.0137.47
4.3.100.0030.0137.47
4.3.90.0000.0177.47
4.3.80.0000.0237.47
4.3.70.0070.0107.47
4.3.60.0030.0137.47
4.3.50.0000.0177.47
4.3.40.0030.0207.47
4.3.30.0000.0177.47
4.3.20.0030.0137.47
4.3.10.0030.0137.47
4.3.00.0000.0137.47

preferences:
39.61 ms | 401 KiB | 5 Q