3v4l.org

run code in 300+ PHP versions simultaneously
<?php // Everything you enter here will be executed by our servers. Try it! class Contract { private $startDate; private $numberofDays; private $endDate; public function __construct($startDate, $numberofDays) { $this->startDate = \DateTime::createFromFormat('Y-m-d', $startDate); $this->numberofDays = $numberofDays; $this->endDate = $this->getEndDate(); } public function overLap(Contract $other) { $overlap = false; if($other->getEndDate() < $this->startDate || $other->getStartDate() > $this->endDate){ $overlap = true; } return $overlap; } /** * Given the start date of a contract will return the end date, skipping weekends * * @return Array of date strings */ public function getDeadline() { $start = (new \DateTime())->setTimestamp($this->startDate->getTimestamp()); $interval = new DateInterval('P1D'); $result = array(); $i = 0; while($i < $this->numberofDays){ if((int)$start->format('N') < 6){ $result[] = $start->format('Y-m-d'); $i++; } $start->add($interval); } return $result; } public function getEndDate() { if(!$this->endDate){ $dates = $this->getDeadline(); $this->endDate = end($dates); } return $this->endDate; } public function getStartDate() { return $this->startDate; } }

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.0080.00818.43
8.3.50.0070.01021.88
8.3.40.0120.00918.63
8.3.30.0030.01019.00
8.3.20.0000.00720.34
8.3.10.0040.00423.48
8.3.00.0040.00422.40
8.2.180.0110.00416.38
8.2.170.0070.00722.96
8.2.160.0070.00722.21
8.2.150.0080.00024.18
8.2.140.0080.00024.66
8.2.130.0040.00426.16
8.2.120.0040.00417.50
8.2.110.0000.00822.23
8.2.100.0070.00617.66
8.2.90.0000.00819.01
8.2.80.0030.00617.97
8.2.70.0040.00417.25
8.2.60.0030.00617.66
8.2.50.0040.00418.07
8.2.40.0080.00318.09
8.2.30.0070.00018.03
8.2.20.0040.00417.58
8.2.10.0040.00417.54
8.2.00.0050.00217.61
8.1.280.0100.01025.92
8.1.270.0040.00423.86
8.1.260.0030.00526.35
8.1.250.0070.00028.09
8.1.240.0090.00023.93
8.1.230.0060.00618.98
8.1.220.0050.00317.74
8.1.210.0040.00418.77
8.1.200.0060.00317.23
8.1.190.0060.00317.29
8.1.180.0040.00418.10
8.1.170.0030.00618.48
8.1.160.0040.00421.90
8.1.150.0040.00418.43
8.1.140.0050.00217.31
8.1.130.0050.00317.81
8.1.120.0000.00817.37
8.1.110.0000.00717.39
8.1.100.0000.00717.36
8.1.90.0020.00517.38
8.1.80.0000.00717.45
8.1.70.0000.00717.32
8.1.60.0000.00817.45
8.1.50.0000.00817.37
8.1.40.0040.00417.38
8.1.30.0040.00417.54
8.1.20.0040.00417.62
8.1.10.0000.00717.50
8.1.00.0050.00317.40
8.0.300.0000.00818.77
8.0.290.0000.00717.03
8.0.280.0030.00318.36
8.0.270.0030.00317.19
8.0.260.0030.00316.66
8.0.250.0030.00316.87
8.0.240.0070.00016.91
8.0.230.0020.00516.84
8.0.220.0040.00416.80
8.0.210.0070.00016.77
8.0.200.0000.00716.75
8.0.190.0000.00716.86
8.0.180.0050.00316.72
8.0.170.0000.00816.82
8.0.160.0030.00616.77
8.0.150.0070.00016.76
8.0.140.0040.00416.66
8.0.130.0030.00313.27
8.0.120.0000.00816.80
8.0.110.0040.00416.64
8.0.100.0000.00716.87
8.0.90.0030.00616.75
8.0.80.0030.01916.69
8.0.70.0020.00516.70
8.0.60.0000.00716.61
8.0.50.0070.00016.78
8.0.30.0060.01316.89
8.0.20.0100.00917.40
8.0.10.0070.00016.88
8.0.00.0140.00916.67
7.4.330.0000.00515.00
7.4.320.0000.00616.54
7.4.300.0030.00316.47
7.4.290.0030.00316.48
7.4.280.0000.00716.39
7.4.270.0030.00316.52
7.4.260.0040.00316.35
7.4.250.0000.00716.47
7.4.240.0000.00716.40
7.4.230.0070.00016.25
7.4.220.0110.00416.57
7.4.210.0050.01016.54
7.4.200.0040.00416.37
7.4.190.0070.00016.64
7.4.160.0130.00316.25
7.4.150.0080.00817.40
7.4.140.0170.00317.86
7.4.130.0070.01116.49
7.4.120.0090.00916.37
7.4.110.0040.01216.44
7.4.100.0130.01016.48
7.4.90.0110.00716.48
7.4.80.0130.00316.36
7.4.70.0060.01016.36
7.4.60.0150.00316.40
7.4.50.0090.00016.32
7.4.40.0080.00822.77
7.4.30.0100.01016.25
7.4.00.0040.01214.82
7.3.330.0000.00713.22
7.3.320.0000.00613.17
7.3.310.0030.00316.20
7.3.300.0040.00416.05
7.3.290.0110.00616.16
7.3.280.0110.00516.20
7.3.270.0130.00317.40
7.3.260.0140.00416.23
7.3.250.0100.00716.34
7.3.240.0110.00616.11
7.3.230.0100.01016.41
7.3.210.0040.01416.50
7.3.200.0100.01019.39
7.3.190.0110.00916.34
7.3.180.0130.00316.37
7.3.170.0040.01616.27
7.3.160.0110.00616.16
7.3.120.0060.01014.86
7.3.110.0120.00614.67
7.3.100.0000.01714.63
7.3.90.0030.00814.87
7.3.80.0030.00614.58
7.3.70.0050.00514.63
7.3.60.0080.00414.40
7.3.50.0040.00814.41
7.3.40.0070.00714.82
7.3.30.0080.00014.61
7.3.20.0030.00616.71
7.3.10.0060.00716.43
7.3.00.0040.00916.49
7.2.330.0110.00716.53
7.2.320.0150.00816.51
7.2.310.0060.01516.25
7.2.300.0090.00816.32
7.2.290.0080.01416.54
7.2.240.0040.00815.03
7.2.230.0100.00714.97
7.2.220.0030.01314.85
7.2.210.0030.00614.99
7.2.200.0120.00415.05
7.2.190.0030.00914.95
7.2.180.0040.00815.05
7.2.170.0090.00614.50
7.2.160.0040.00714.88
7.2.150.0070.00716.44
7.2.140.0070.00716.64
7.2.130.0070.00716.70
7.2.120.0050.00916.73
7.2.110.0020.01316.74
7.2.100.0050.01216.64
7.2.90.0000.01316.78
7.2.80.0040.00616.77
7.2.70.0060.00716.81
7.2.60.0050.00916.60
7.2.50.0060.00516.80
7.2.40.0090.00516.46
7.2.30.0080.00516.80
7.2.20.0060.00916.77
7.2.10.0030.00816.67
7.2.00.0050.00717.34
7.1.330.0070.00515.62
7.1.320.0100.00615.30
7.1.310.0030.01315.48
7.1.300.0000.00915.61
7.1.290.0090.00415.54
7.1.280.0060.00615.73
7.1.270.0040.00415.35
7.1.260.0000.01215.74
7.1.250.0070.00515.42
7.1.200.0060.00615.57
7.1.100.0030.00918.07
7.1.70.0030.00716.99
7.1.60.0130.01019.32
7.1.50.0130.01016.77
7.1.00.0030.07722.32
7.0.200.0100.00316.77
7.0.140.0100.06322.09
7.0.100.0030.08319.89
7.0.90.0100.07319.97
7.0.80.0070.08320.11
7.0.70.0130.07319.89
7.0.60.0100.08020.04
7.0.50.0030.06720.23
7.0.40.0100.07719.96
7.0.30.0000.07020.11
7.0.20.0070.08020.06
7.0.10.0030.09020.13
7.0.00.0070.06720.05
5.6.280.0030.07321.12
5.6.250.0130.07720.61
5.6.240.0100.07020.65
5.6.230.0130.07720.60
5.6.220.0100.07720.58
5.6.210.0030.07020.61
5.6.200.0100.07720.92
5.6.190.0130.08021.00
5.6.180.0030.07721.04
5.6.170.0030.09020.95
5.6.160.0100.08021.11
5.6.150.0130.07021.07
5.6.140.0100.07721.02
5.6.130.0070.08721.02
5.6.120.0130.07721.07
5.6.110.0000.06721.01
5.6.100.0130.07720.90
5.6.90.0070.08020.99
5.6.80.0130.07320.39
5.6.70.0100.07720.36
5.6.60.0100.04720.30
5.6.50.0130.07320.47
5.6.40.0070.07320.28
5.6.30.0100.07720.35
5.6.20.0100.07320.49
5.6.10.0130.07320.34
5.6.00.0130.07320.35
5.5.380.0030.09020.35
5.5.370.0030.08020.33
5.5.360.0070.08020.51
5.5.350.0370.06020.41
5.5.340.0200.07720.84
5.5.330.0030.08020.75
5.5.320.0130.08020.89
5.5.310.0030.08720.79
5.5.300.0130.06320.80
5.5.290.0100.07720.78
5.5.280.0130.07720.89
5.5.270.0170.07020.88
5.5.260.0100.07320.79
5.5.250.0130.07320.54
5.5.240.0030.08020.23
5.5.230.0100.07720.13
5.5.220.0130.07020.18
5.5.210.0070.06720.23
5.5.200.0030.07020.13
5.5.190.0030.07020.18
5.5.180.0070.07720.20
5.5.160.0100.07020.09
5.5.150.0170.06720.25
5.5.140.0070.08020.06
5.5.130.0030.08720.12
5.5.120.0100.07020.15
5.5.110.0070.06720.25
5.5.100.0130.07720.05
5.5.90.0070.07720.13
5.5.80.0130.05019.92
5.5.70.0070.08320.12
5.5.60.0130.07320.13
5.5.50.0100.07020.06
5.5.40.0100.07320.09
5.5.30.0100.04320.09
5.5.20.0030.04020.02
5.5.10.0130.07020.02
5.5.00.0170.06719.91
5.4.450.0030.08319.46
5.4.440.0100.07719.46
5.4.430.0070.09019.37
5.4.420.0030.07719.45
5.4.410.0100.07719.14
5.4.400.0070.05719.19
5.4.390.0100.07319.14
5.4.380.0030.07719.05
5.4.370.0070.07019.03
5.4.360.0130.07019.05
5.4.350.0000.08319.13
5.4.340.0070.07719.08
5.4.320.0170.06319.21
5.4.310.0030.08018.88
5.4.300.0170.06318.86
5.4.290.0100.06018.84
5.4.280.0130.07318.91
5.4.270.0070.07319.16
5.4.260.0000.08019.14
5.4.250.0100.05319.24
5.4.240.0170.06719.03
5.4.230.0130.06018.87
5.4.220.0070.08019.12
5.4.210.0200.06319.14
5.4.200.0100.06719.12
5.4.190.0100.08019.03
5.4.180.0170.07019.19
5.4.170.0100.06719.17
5.4.160.0070.07719.00
5.4.150.0030.08019.02
5.4.140.0100.06716.38
5.4.130.0100.06716.36
5.4.120.0030.06716.36
5.4.110.0070.06716.53
5.4.100.0070.07316.28
5.4.90.0070.07016.43
5.4.80.0030.07016.27
5.4.70.0070.07016.34
5.4.60.0070.06316.45
5.4.50.0170.06016.40
5.4.40.0030.03716.50
5.4.30.0070.07316.25
5.4.20.0100.06716.39
5.4.10.0000.07716.33
5.4.00.0100.06315.75
5.3.290.0070.06014.65
5.3.280.0100.07714.54
5.3.270.0070.06714.54
5.3.260.0100.07714.68
5.3.250.0130.06314.55
5.3.240.0130.06314.65
5.3.230.0030.07014.61
5.3.220.0170.05314.73
5.3.210.0130.07014.50
5.3.200.0130.07014.63
5.3.190.0070.07314.69
5.3.180.0070.05014.59
5.3.170.0030.07714.61
5.3.160.0100.07714.64
5.3.150.0100.06714.50
5.3.140.0170.04314.50
5.3.130.0070.07714.70
5.3.120.0100.07014.51
5.3.110.0070.07714.68
5.3.100.0030.07714.19
5.3.90.0070.05714.13
5.3.80.0030.07314.06
5.3.70.0070.07314.13
5.3.60.0100.07313.90
5.3.50.0100.06714.02
5.3.40.0070.07313.99
5.3.30.0030.08014.04
5.3.20.0100.06713.64
5.3.10.0000.07713.72
5.3.00.0170.06313.68
5.2.170.0030.05711.26
5.2.160.0070.05711.29
5.2.150.0000.04011.25
5.2.140.0030.05011.01
5.2.130.0030.06011.23
5.2.120.0070.06011.10
5.2.110.0070.06011.16
5.2.100.0100.06011.17
5.2.90.0100.05311.04
5.2.80.0100.05711.23
5.2.70.0000.07011.09
5.2.60.0030.06710.93
5.2.50.0030.05311.06
5.2.40.0100.05310.89
5.2.30.0030.05710.84
5.2.20.0030.04010.98
5.2.10.0030.06010.94
5.2.00.0070.05010.64
5.1.60.0030.0479.89
5.1.50.0030.05010.09
5.1.40.0070.05010.00
5.1.30.0100.03310.42
5.1.20.0030.05710.23
5.1.10.0100.0479.93
5.1.00.0030.0509.96
5.0.50.0030.0438.41
5.0.40.0030.0438.26
5.0.30.0000.0678.32
5.0.20.0070.0378.30
5.0.10.0030.0478.28
5.0.00.0030.0638.25
4.4.90.0070.0338.18
4.4.80.0000.0408.18
4.4.70.0070.0208.18
4.4.60.0000.0408.18
4.4.50.0030.0338.18
4.4.40.0030.0578.18
4.4.30.0070.0338.18
4.4.20.0000.0338.18
4.4.10.0030.0278.18
4.4.00.0000.0538.18
4.3.110.0000.0378.18
4.3.100.0030.0338.18
4.3.90.0030.0338.18
4.3.80.0030.0538.18
4.3.70.0000.0378.18
4.3.60.0000.0278.18
4.3.50.0030.0338.18
4.3.40.0070.0478.18
4.3.30.0000.0408.18
4.3.20.0000.0408.18
4.3.10.0000.0378.18
4.3.00.0000.0378.18

preferences:
44.92 ms | 401 KiB | 5 Q