3v4l.org

run code in 300+ PHP versions simultaneously
<?php // Example 1 print_r(getPeroid()); print_r(getPeroid()->start); // Example 2 print_r(getPeroid(new DateTime("2013-02-14"))); // Example 3 print_r(getPeriodBetween(new DateTime("2013-1-1"), new DateTime())); function getPeroid(\Datetime $date = null, DateInterval $interval = null) { $interval = $interval ? : new DateInterval('P7D'); $end = $date ? : new DateTime(); $end->modify("Last Sunday"); $start = clone $end; $start->sub($interval); return (object) array( "start" => $start->format("l, d F Y"), "end" => $end->format("l, d F Y") ); } function getPeriodBetween(Datetime $start = null, Datetime $end = null, DateInterval $interval = null) { $interval = $interval ? : new DateInterval('P7D'); if ($start === null) { $start = new DateTime(); $start->modify("First Sunday of January"); } else { $start->modify("First Sunday"); } if ($end === null) { $end = new DateTime(); $end->modify("Last Sunday of December"); } $range = array(); while ( $start < $end ) { $r = (object) array( "start" => $start->format("l, d F Y") ); $start->add($interval); $r->end = $start->format("l, d F Y"); $range[] = $r; } return $range; } ?>

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.0180.00416.63
8.3.50.0100.00522.22
8.3.40.0110.00418.84
8.3.30.0120.00319.08
8.3.20.0000.00720.33
8.3.10.0110.00323.83
8.3.00.0040.00421.02
8.2.180.0090.00918.79
8.2.170.0100.01022.96
8.2.160.0070.01020.29
8.2.150.0040.00424.18
8.2.140.0040.00424.66
8.2.130.0040.01226.16
8.2.120.0000.00819.90
8.2.110.0090.00022.14
8.2.100.0040.00818.03
8.2.90.0040.00419.05
8.2.80.0040.00417.97
8.2.70.0060.00317.88
8.2.60.0000.01018.18
8.2.50.0030.00618.07
8.2.40.0050.00321.25
8.2.30.0040.00418.34
8.2.20.0000.00717.97
8.2.10.0040.00418.26
8.2.00.0000.00818.02
8.1.280.0170.00325.92
8.1.270.0040.00423.95
8.1.260.0080.00026.35
8.1.250.0000.00728.09
8.1.240.0090.00023.95
8.1.230.0040.00719.09
8.1.220.0080.00017.79
8.1.210.0050.00318.77
8.1.200.0000.01417.72
8.1.190.0050.00317.50
8.1.180.0040.00418.10
8.1.170.0080.00018.83
8.1.160.0040.00422.00
8.1.150.0040.00418.98
8.1.140.0030.00617.59
8.1.130.0000.00717.72
8.1.120.0070.00017.72
8.1.110.0000.00717.67
8.1.100.0040.00417.73
8.1.90.0070.00017.63
8.1.80.0050.00317.63
8.1.70.0070.00017.72
8.1.60.0080.00017.72
8.1.50.0000.00817.68
8.1.40.0030.00517.72
8.1.30.0060.00317.90
8.1.20.0000.00817.86
8.1.10.0050.00317.71
8.1.00.0030.00517.66
8.0.300.0060.00318.77
8.0.290.0000.00717.30
8.0.280.0050.00218.59
8.0.270.0000.00717.27
8.0.260.0000.00717.09
8.0.250.0000.00717.24
8.0.240.0030.00617.20
8.0.230.0050.00217.18
8.0.220.0080.00017.19
8.0.210.0070.00017.15
8.0.200.0000.00717.24
8.0.190.0040.00417.06
8.0.180.0070.00017.20
8.0.170.0000.00817.08
8.0.160.0000.00717.21
8.0.150.0050.00217.16
8.0.140.0000.00817.14
8.0.130.0050.00013.52
8.0.120.0040.00417.16
8.0.110.0000.00717.19
8.0.100.0000.00717.05
8.0.90.0020.00517.03
8.0.80.0120.00917.15
8.0.70.0040.00417.20
8.0.60.0060.00316.99
8.0.50.0060.00317.19
8.0.30.0110.01117.25
8.0.20.0100.01317.40
8.0.10.0000.00817.18
8.0.00.0090.00917.03
7.4.330.0080.00015.00
7.4.320.0030.00316.71
7.4.300.0000.00716.70
7.4.290.0030.00316.64
7.4.280.0030.00316.76
7.4.270.0050.00516.71
7.4.260.0040.00416.68
7.4.250.0000.00816.66
7.4.240.0010.00616.78
7.4.230.0000.00716.88
7.4.220.0060.01616.64
7.4.210.0050.01216.73
7.4.200.0000.00716.72
7.4.190.0040.00416.66
7.4.160.0160.00416.86
7.4.150.0140.00417.40
7.4.140.0140.00917.86
7.4.130.0120.00716.79
7.4.120.0160.00416.73
7.4.110.0110.01116.59
7.4.100.0150.00916.71
7.4.90.0150.00616.64
7.4.80.0110.00719.39
7.4.70.0180.00316.85
7.4.60.0040.01316.70
7.4.50.0030.00616.63
7.4.40.0110.00716.75
7.4.30.0200.00316.52
7.4.00.0100.01015.27
7.3.330.0030.00313.50
7.3.320.0000.00613.57
7.3.310.0040.00416.60
7.3.300.0020.00516.52
7.3.290.0060.01216.57
7.3.280.0090.01216.58
7.3.270.0120.00617.40
7.3.260.0120.00616.63
7.3.250.0130.00916.79
7.3.240.0120.01316.62
7.3.230.0110.00616.59
7.3.210.0070.01116.80
7.3.200.0100.00719.39
7.3.190.0120.00616.87
7.3.180.0100.01016.86
7.3.170.0060.01216.63
7.3.160.0090.00616.86
7.3.120.0090.00715.11
7.3.110.0060.00915.05
7.3.100.0040.01114.94
7.3.90.0130.00015.13
7.3.80.0110.00415.28
7.3.70.0090.00615.14
7.3.60.0050.00514.90
7.3.50.0060.00615.07
7.3.40.0070.00715.21
7.3.30.0000.01215.06
7.3.20.0070.00416.95
7.3.10.0080.00516.70
7.3.00.0040.00816.75
7.2.330.0090.00916.79
7.2.320.0070.01417.09
7.2.310.0130.01317.00
7.2.300.0160.00017.02
7.2.290.0030.01416.81
7.2.250.0070.01115.63
7.2.240.0160.00015.46
7.2.230.0050.01015.16
7.2.220.0060.00315.50
7.2.210.0100.00715.37
7.2.200.0070.00315.32
7.2.190.0040.00815.14
7.2.180.0030.00815.50
7.2.170.0030.00615.53
7.2.00.0050.00519.46
7.1.330.0030.01215.77
7.1.320.0040.01215.95
7.1.310.0070.00716.18
7.1.300.0060.00616.03
7.1.290.0030.00615.80
7.1.280.0070.00315.74
7.1.270.0100.00316.08
7.1.260.0100.00316.10
7.1.100.0000.01018.54
7.1.70.0000.00717.51
7.1.60.0150.01119.46
7.1.50.0040.00816.94
7.1.00.0070.07322.28
7.0.200.0040.00817.08
7.0.140.0030.07722.01
7.0.70.0030.08321.74
7.0.60.0000.04321.87
7.0.50.0030.05722.12
7.0.40.0100.08720.09
7.0.30.0070.08720.00
7.0.20.0100.08020.09
7.0.10.0130.07720.14
7.0.00.0070.08320.10
5.6.220.0170.07720.50
5.6.210.0030.04320.65
5.6.200.0070.08321.06
5.6.190.0070.08021.11
5.6.180.0000.05721.15
5.6.170.0070.08020.96
5.6.160.0000.08021.06
5.6.150.0100.08321.08
5.6.140.0100.08321.18
5.6.130.0070.07721.14
5.6.120.0070.08721.11
5.6.110.0100.06721.11
5.6.100.0030.08720.96
5.6.90.0070.08721.08
5.6.80.0070.07720.50
5.6.70.0000.05020.45
5.6.60.0070.08320.47
5.6.50.0070.05320.35
5.6.40.0070.08720.48
5.6.30.0000.04720.37
5.6.20.0070.05320.50
5.6.10.0070.07720.45
5.6.00.0030.08320.38
5.5.360.0130.03320.36
5.5.350.0000.09320.46
5.5.340.0000.04720.89
5.5.330.0030.05320.92
5.5.320.0000.04320.91
5.5.310.0100.08020.77
5.5.300.0030.06720.81
5.5.290.0070.05720.93
5.5.280.0030.05720.73
5.5.270.0070.08720.84
5.5.260.0000.06320.77
5.5.250.0030.08720.74
5.5.240.0030.08020.28
5.5.230.0000.08720.27
5.5.220.0030.06720.12
5.5.210.0030.08320.16
5.5.200.0070.08020.25
5.5.190.0070.08320.20
5.5.180.0070.06020.16
5.5.160.0070.05020.13
5.5.150.0030.08020.27
5.5.140.0000.06020.29
5.5.130.0070.08020.16
5.5.120.0000.04320.09
5.5.110.0030.05320.07
5.5.100.0100.07720.18
5.5.90.0070.04720.16
5.5.80.0030.04320.11
5.5.70.0070.07720.01
5.5.60.0070.07720.10
5.5.50.0130.07020.02
5.5.40.0130.06720.11
5.5.30.0070.06320.11
5.5.20.0130.07320.07
5.5.10.0030.06020.07
5.5.00.0100.08020.04
5.4.450.0130.04019.21
5.4.440.0000.08319.55
5.4.430.0070.07719.36
5.4.420.0070.08019.41
5.4.410.0030.08319.10
5.4.400.0000.08319.07
5.4.390.0030.06019.18
5.4.380.0070.07019.20
5.4.370.0070.07718.87
5.4.360.0030.08319.04
5.4.350.0030.06719.16
5.4.340.0030.07719.04
5.4.320.0030.08019.18
5.4.310.0130.07719.03
5.4.300.0070.05719.18
5.4.290.0030.05718.87
5.4.280.0130.07319.13
5.4.270.0100.07019.03
5.4.260.0070.06019.04
5.4.250.0170.06718.89
5.4.240.0070.08018.85
5.4.230.0070.08019.12
5.4.220.0100.04019.03
5.4.210.0100.05319.11
5.4.200.0000.04319.02
5.4.190.0070.07719.03
5.4.180.0070.06718.93
5.4.170.0070.06719.15
5.4.160.0030.05019.14
5.4.150.0100.07319.03
5.4.140.0100.04016.25
5.4.130.0070.05716.39
5.4.120.0000.07716.48
5.4.110.0000.07716.40
5.4.100.0030.04316.54
5.4.90.0030.07316.54
5.4.80.0070.06716.43
5.4.70.0030.05316.37
5.4.60.0000.04316.43
5.4.50.0130.07016.33
5.4.40.0170.06316.52
5.4.30.0000.08316.34
5.4.20.0000.08016.44
5.4.10.0030.06316.36
5.4.00.0100.07715.90
5.3.290.0100.06714.64
5.3.280.0030.08314.54
5.3.270.0000.06714.64
5.3.260.0100.07014.76
5.3.250.0030.07014.64
5.3.240.0070.06714.57
5.3.230.0070.07314.71
5.3.220.0030.04014.65
5.3.210.0070.07314.73
5.3.200.0070.07714.59
5.3.190.0070.06714.70
5.3.180.0070.07714.59
5.3.170.0030.07314.64
5.3.160.0130.06014.60
5.3.150.0100.05714.62
5.3.140.0070.06014.59
5.3.130.0030.06014.50
5.3.120.0100.05714.63
5.3.110.0030.07714.52
5.3.100.0000.04714.19
5.3.90.0030.08014.15
5.3.80.0100.05714.15
5.3.70.0000.08014.05
5.3.60.0070.06714.13
5.3.50.0100.06313.99
5.3.40.0030.08013.89
5.3.30.0030.07013.93
5.3.20.0030.03313.82
5.3.10.0030.07013.61
5.3.00.0000.07713.71
5.2.170.0000.07312.45
5.2.160.0000.04012.45
5.2.150.0000.03012.45
5.2.140.0000.07012.45
5.2.130.0070.02712.45
5.2.120.0030.06312.45
5.2.110.0070.05712.45
5.2.100.0000.06312.45
5.2.90.0000.06712.45
5.2.80.0030.04712.45
5.2.70.0070.06012.45
5.2.60.0070.06312.45
5.2.50.0030.06312.45
5.2.40.0030.05712.45
5.2.30.0030.06312.45
5.2.20.0000.06312.45
5.2.10.0030.06312.45
5.2.00.0030.06012.45
5.1.60.0000.04712.45
5.1.50.0000.05312.45
5.1.40.0030.05012.45
5.1.30.0000.06012.45
5.1.20.0070.05012.45
5.1.10.0030.05012.45
5.1.00.0000.04012.45
5.0.50.0070.04312.45
5.0.40.0100.03312.45
5.0.30.0030.07012.45
5.0.20.0000.04312.45
5.0.10.0030.03312.45
5.0.00.0130.04012.45
4.4.90.0000.03312.45
4.4.80.0000.03712.45
4.4.70.0030.03012.45
4.4.60.0000.03712.45
4.4.50.0070.02012.45
4.4.40.0030.05012.45
4.4.30.0030.03312.45
4.4.20.0070.03312.45
4.4.10.0030.03712.45
4.4.00.0000.04712.45
4.3.110.0000.03712.45
4.3.100.0000.02712.45
4.3.90.0000.02712.45
4.3.80.0000.05312.45
4.3.70.0000.02312.45
4.3.60.0030.03312.45
4.3.50.0030.03312.45
4.3.40.0000.05312.45
4.3.30.0030.03312.45
4.3.20.0100.02712.45
4.3.10.0100.02712.45
4.3.00.0000.03712.45

preferences:
58.12 ms | 401 KiB | 5 Q