3v4l.org

run code in 300+ PHP versions simultaneously
<?php define("NEE", 99); define("KAN", 1); define("LIEVER_NIET", 2); define("JA", 0); $excludedRanges = [ ['2017-07-20', '2017-07-21', 'Python', NEE], ['2017-08-14', '2017-08-15', 'Python', NEE], ['2017-09-04', '2017-09-08', 'Joris en de Draak', NEE], ['2017-09-04', '2017-11-28', 'De Tuinman en de Fakir', KAN], ['2017-09-04', '2017-09-04', 'Spookslot', JA], ['2017-09-11', '2017-09-22', 'Fata Morgana', LIEVER_NIET], ['2017-09-11', '2017-12-01', 'Python', KAN], ['2017-09-11', '2017-09-15', 'De Oude Tufferbaan', JA], ['2017-09-25', '2017-09-29', 'Carnaval Festival', KAN], ['2017-10-02', '2017-10-06', 'Villa Volta', JA], ['2017-10-02', '2017-10-13', 'Gondoletta', JA], ['2017-10-07', '2017-10-13', 'Aquanura', KAN], ]; $startDate = '2017-09-01'; $endDate = '2017-12-31'; $startDay = date('z', strtotime($startDate)); $endDay = date('z', strtotime($endDate)); # Only wednesdays and fridays $acceptedDays = [3, 5]; for($i = $startDay, $j = 0; $i <= $endDay; $i++, $j++) { $date = date("Y-m-d", strtotime($startDate . " +" . $j . ' days')); $dayOfWeek = date("w", strtotime($date)); if (!in_array($dayOfWeek, $acceptedDays)) { continue; } if (($closed = isAnAttractionClosed($i, $excludedRanges)) !== false) { $highest = getHighestAnswer($i, $excludedRanges); echo date("d-m-Y", strtotime($date)) . ': ' . getClosedAttractions($i, $excludedRanges) . ' gesloten. '; switch ($highest) { case NEE: echo 'Nee.'; break; case KAN: echo 'Kan.'; break; case LIEVER_NIET: echo 'Liever niet.'; break; default: echo 'Ja.'; break; } echo PHP_EOL; continue; } echo date("d-m-Y", strtotime($date)) . ': Ja' . PHP_EOL; } /** * @param int $dayOfTheYear * @param array $closedAttractions * @return bool */ function isAnAttractionClosed($dayOfTheYear, $closedAttractions) { foreach ($closedAttractions as $closed) { $start = date('z', strtotime($closed[0])); $end = date('z', strtotime($closed[1])); if ($dayOfTheYear >= $start && $dayOfTheYear <= $end) { return $closed; } } return false; } function getHighestAnswer($dayOfTheYear, $closedAttractions) { $highest = JA; foreach ($closedAttractions as $closed) { $start = date('z', strtotime($closed[0])); $end = date('z', strtotime($closed[1])); if ($dayOfTheYear >= $start && $dayOfTheYear <= $end) { if ($closed[3] > $highest) { $highest = $closed[3]; } } } return $highest; } function getClosedAttractions($dayOfTheYear, $closedAttractions) { $attractions = ''; foreach ($closedAttractions as $closed) { $start = date('z', strtotime($closed[0])); $end = date('z', strtotime($closed[1])); if ($dayOfTheYear >= $start && $dayOfTheYear <= $end) { $attractions .= $closed[2] . ', '; } } return rtrim($attractions, ', '); }

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.0140.01418.68
8.3.60.0070.01316.88
8.3.50.0050.02116.66
8.3.40.0130.01319.27
8.3.30.0160.01318.95
8.3.20.0030.00720.42
8.3.10.0070.02021.85
8.3.00.0040.00722.13
8.2.180.0150.01517.00
8.2.170.0060.02322.96
8.2.160.0160.01320.52
8.2.150.0200.00724.18
8.2.140.0160.00624.66
8.2.130.0070.00421.23
8.2.120.0060.01526.35
8.2.110.0030.01020.99
8.2.100.0140.00618.09
8.2.90.0030.00919.52
8.2.80.0040.00818.28
8.2.70.0060.00618.00
8.2.60.0040.00818.18
8.2.50.0060.00618.28
8.2.40.0000.01120.61
8.2.30.0030.00821.11
8.2.20.0040.00718.40
8.2.10.0060.01018.21
8.2.00.0080.00318.33
8.1.280.0100.02025.92
8.1.270.0070.00422.39
8.1.260.0100.01726.35
8.1.250.0130.01328.09
8.1.240.0070.00721.13
8.1.230.0090.00619.26
8.1.220.0040.00817.91
8.1.210.0070.00718.77
8.1.200.0040.01217.61
8.1.190.0030.00917.73
8.1.180.0040.00818.10
8.1.170.0030.01018.57
8.1.160.0080.00419.22
8.1.150.0060.00620.71
8.1.140.0030.00819.73
8.1.130.0040.00818.98
8.1.120.0000.01217.85
8.1.110.0030.00917.74
8.1.100.0000.01217.69
8.1.90.0000.01217.73
8.1.80.0000.01317.82
8.1.70.0000.01317.86
8.1.60.0030.01017.82
8.1.50.0070.01017.86
8.1.40.0080.00617.77
8.1.30.0000.01217.91
8.1.20.0000.01317.95
8.1.10.0000.01217.83
8.1.00.0070.00717.80
8.0.300.0070.00620.29
8.0.290.0040.00717.00
8.0.280.0030.00718.62
8.0.270.0040.00917.38
8.0.260.0060.00617.15
8.0.250.0030.00717.26
8.0.240.0000.01517.30
8.0.230.0030.00717.15
8.0.220.0000.01317.11
8.0.210.0030.01017.11
8.0.200.0000.01017.19
8.0.190.0050.00517.16
8.0.180.0030.00817.14
8.0.170.0030.01017.16
8.0.160.0030.00817.21
8.0.150.0060.00617.18
8.0.140.0030.00917.21
8.0.130.0000.00913.60
8.0.120.0000.01117.13
8.0.110.0040.00717.21
8.0.100.0060.00617.21
8.0.90.0060.00617.19
8.0.80.0060.02017.14
8.0.70.0070.00717.29
8.0.60.0030.00917.34
8.0.50.0080.00317.22
8.0.30.0100.01717.39
8.0.20.0090.01917.55
8.0.10.0060.00617.29
8.0.00.0060.01917.01
7.4.330.0030.00615.55
7.4.320.0000.01016.74
7.4.300.0030.00616.68
7.4.290.0070.00716.82
7.4.280.0080.00416.86
7.4.270.0030.00716.88
7.4.260.0030.01016.83
7.4.250.0040.00816.72
7.4.240.0030.00916.80
7.4.230.0000.01116.95
7.4.220.0130.01316.96
7.4.210.0080.01816.79
7.4.200.0030.01216.99
7.4.160.0170.00916.74
7.4.150.0110.01417.40
7.4.140.0130.01617.86
7.4.130.0210.00916.76
7.4.120.0130.01916.82
7.4.110.0130.01316.93
7.4.100.0170.00716.75
7.4.90.0150.01116.78
7.4.80.0130.01319.39
7.4.70.0110.02116.76
7.4.60.0100.01416.72
7.4.50.0040.01816.92
7.4.40.0080.01616.90
7.4.30.0070.02316.96
7.4.10.0090.01915.45
7.4.00.0050.01715.23
7.3.330.0060.00313.48
7.3.320.0030.00713.51
7.3.310.0030.00916.70
7.3.300.0090.00316.52
7.3.290.0000.01016.55
7.3.280.0080.01616.65
7.3.270.0130.02217.40
7.3.260.0170.01016.64
7.3.250.0160.01016.84
7.3.240.0080.01616.88
7.3.230.0130.01116.84
7.3.210.0050.01916.70
7.3.200.0130.01316.82
7.3.190.0090.02016.60
7.3.180.0000.02316.77
7.3.170.0100.01616.73
7.3.160.0120.02516.76
7.3.130.0070.02015.36
7.3.120.0100.01615.03
7.3.110.0070.02115.44
7.3.100.0040.01415.25
7.3.90.0030.01715.05
7.3.80.0090.01214.86
7.3.70.0060.01015.16
7.3.60.0000.01915.13
7.3.50.0040.01915.27
7.3.40.0060.01615.17
7.3.30.0120.00914.96
7.3.20.0110.00816.95
7.3.10.0070.01416.92
7.3.00.0030.02216.82
7.2.330.0130.01616.94
7.2.320.0030.02516.86
7.2.310.0060.01617.20
7.2.300.0100.01317.11
7.2.290.0150.01917.16
7.2.260.0110.01515.47
7.2.250.0040.01815.30
7.2.240.0100.01015.15
7.2.230.0100.01315.43
7.2.220.0030.01715.55
7.2.210.0030.01715.52
7.2.200.0000.02015.24
7.2.190.0030.01715.52
7.2.180.0070.01315.50
7.2.170.0030.01715.38
7.2.160.0030.01615.16
7.2.150.0030.01416.99
7.2.140.0090.00917.28
7.2.130.0030.02017.03
7.2.120.0000.02117.29
7.2.110.0000.02017.22
7.2.100.0120.00916.92
7.2.90.0100.01317.05
7.2.80.0090.00917.35
7.2.70.0060.01217.11
7.2.60.0390.01016.45
7.2.50.0070.01317.32
7.2.40.0090.01217.35
7.2.30.0070.01317.31
7.2.20.0030.01717.01
7.2.10.0030.02017.23
7.2.00.0030.01618.37
7.1.330.0040.01516.14
7.1.320.0040.01116.15
7.1.310.0070.01516.14
7.1.300.0070.01416.17
7.1.290.0070.01716.17
7.1.280.0130.00716.07
7.1.270.0030.01715.86
7.1.260.0070.02016.18
7.1.250.0090.00915.79
7.1.240.0040.01916.09
7.1.230.0000.02016.16
7.1.220.0040.01515.74
7.1.210.0000.01415.93
7.1.200.0030.01516.05
7.1.190.0060.00916.13
7.1.180.0070.01715.89
7.1.170.0070.01316.08
7.1.160.0030.01715.93
7.1.150.0000.01416.20
7.1.140.0000.01516.05
7.1.130.0070.01416.19
7.1.120.0060.01515.98
7.1.110.0060.01016.01
7.1.100.0050.01517.26
7.1.90.0070.01716.15
7.1.80.0000.01415.68
7.1.70.0070.01016.91
7.1.60.0030.02116.57
7.1.50.0060.01416.54
7.1.40.0060.01716.43
7.1.30.0050.01916.31
7.1.20.0020.01916.38
7.1.10.0020.02016.52
7.1.00.0090.00616.31
7.0.330.0080.00815.55
7.0.320.0070.01115.59
7.0.310.0000.01915.63
7.0.300.0060.01615.40
7.0.290.0030.01715.73
7.0.280.0030.01715.52
7.0.270.0060.01315.48
7.0.260.0100.01015.54
7.0.250.0070.01415.55
7.0.240.0090.01215.42
7.0.230.0030.01315.66
7.0.220.0030.01415.31
7.0.210.0040.01415.36
7.0.200.0090.01616.18
7.0.190.0020.01816.16
7.0.180.0050.01016.13
7.0.170.0050.01816.11
7.0.160.0020.01616.08
7.0.150.0050.01215.99
7.0.140.0050.01216.15
7.0.130.0080.00816.23
7.0.120.0070.01016.01
7.0.110.0020.01616.03
7.0.100.0000.02016.12
7.0.90.0030.00916.07
7.0.80.0030.02216.08
7.0.70.0070.01115.92
7.0.60.0020.02315.84
7.0.50.0030.01816.15
7.0.40.0020.01914.66
7.0.30.0050.00914.52
7.0.20.0060.00914.48
7.0.10.0040.01014.50
7.0.00.0030.01014.63
5.6.400.0090.01614.26
5.6.390.0000.02014.63
5.6.380.0100.01314.73
5.6.370.0030.01714.64
5.6.360.0100.01314.55
5.6.350.0030.01914.48
5.6.340.0040.01914.90
5.6.330.0070.01714.53
5.6.320.0090.01614.19
5.6.310.0100.01314.85
5.6.300.0060.01914.85
5.6.290.0030.01614.81
5.6.280.0100.01314.55
5.6.270.0100.01414.75
5.6.260.0130.01014.28
5.6.250.0100.01014.54
5.6.240.0000.01614.71
5.6.230.0070.01714.57
5.6.220.0090.01514.53
5.6.210.0120.00914.48
5.6.200.0000.02514.50
5.6.190.0110.01914.45
5.6.180.0100.00714.47
5.6.170.0030.02014.27
5.6.160.0090.01214.49
5.6.150.0060.01314.60
5.6.140.0030.01914.59
5.6.130.0070.01714.71
5.6.120.0000.02414.81
5.6.110.0100.01314.64
5.6.100.0030.01714.87
5.6.90.0070.01414.80
5.6.80.0130.01314.44
5.6.70.0030.02014.46
5.6.60.0060.01614.37
5.6.50.0000.01614.30
5.6.40.0030.01814.53
5.6.30.0030.02014.36
5.6.20.0090.00914.38
5.6.10.0060.01914.38
5.6.00.0000.01614.66

preferences:
45.05 ms | 401 KiB | 5 Q