3v4l.org

run code in 300+ PHP versions simultaneously
<?php /** * @param \DateTime $date Date of the original meeting * @return \DateTime Date of the next meeting */ function getSameDayNextYear(\DateTime $date = null) { if(!$date){ $date = new \DateTime(); } return (new \DateTime())->setISODate((int)$date->format('o') + 1, (int)$date->format('W'), (int)$date->format('N')); } $start = new \DateTime(); $end = new \DateTime('+ 4 months'); $interval = new \DateInterval('P5D'); $period = new \DatePeriod($start, $interval, $end); $format = 'l d-m-Y'; $date = new \DateTime('2014-05-23'); for($i = 0; $i < 100; $i++){ echo $date->format($format) . "\n"; $date = getSameDayNextYear($date); }
Output for 8.4.1 - 8.4.2
Deprecated: getSameDayNextYear(): Implicitly marking parameter $date as nullable is deprecated, the explicit nullable type must be used instead in /in/3cLIS on line 6 Friday 23-05-2014 Friday 22-05-2015 Friday 27-05-2016 Friday 26-05-2017 Friday 25-05-2018 Friday 24-05-2019 Friday 22-05-2020 Friday 28-05-2021 Friday 27-05-2022 Friday 26-05-2023 Friday 24-05-2024 Friday 23-05-2025 Friday 22-05-2026 Friday 28-05-2027 Friday 26-05-2028 Friday 25-05-2029 Friday 24-05-2030 Friday 23-05-2031 Friday 21-05-2032 Friday 27-05-2033 Friday 26-05-2034 Friday 25-05-2035 Friday 23-05-2036 Friday 22-05-2037 Friday 28-05-2038 Friday 27-05-2039 Friday 25-05-2040 Friday 24-05-2041 Friday 23-05-2042 Friday 22-05-2043 Friday 27-05-2044 Friday 26-05-2045 Friday 25-05-2046 Friday 24-05-2047 Friday 22-05-2048 Friday 28-05-2049 Friday 27-05-2050 Friday 26-05-2051 Friday 24-05-2052 Friday 23-05-2053 Friday 22-05-2054 Friday 28-05-2055 Friday 26-05-2056 Friday 25-05-2057 Friday 24-05-2058 Friday 23-05-2059 Friday 21-05-2060 Friday 27-05-2061 Friday 26-05-2062 Friday 25-05-2063 Friday 23-05-2064 Friday 22-05-2065 Friday 28-05-2066 Friday 27-05-2067 Friday 25-05-2068 Friday 24-05-2069 Friday 23-05-2070 Friday 22-05-2071 Friday 27-05-2072 Friday 26-05-2073 Friday 25-05-2074 Friday 24-05-2075 Friday 22-05-2076 Friday 28-05-2077 Friday 27-05-2078 Friday 26-05-2079 Friday 24-05-2080 Friday 23-05-2081 Friday 22-05-2082 Friday 28-05-2083 Friday 26-05-2084 Friday 25-05-2085 Friday 24-05-2086 Friday 23-05-2087 Friday 21-05-2088 Friday 27-05-2089 Friday 26-05-2090 Friday 25-05-2091 Friday 23-05-2092 Friday 22-05-2093 Friday 28-05-2094 Friday 27-05-2095 Friday 25-05-2096 Friday 24-05-2097 Friday 23-05-2098 Friday 22-05-2099 Friday 28-05-2100 Friday 27-05-2101 Friday 26-05-2102 Friday 25-05-2103 Friday 23-05-2104 Friday 22-05-2105 Friday 28-05-2106 Friday 27-05-2107 Friday 25-05-2108 Friday 24-05-2109 Friday 23-05-2110 Friday 22-05-2111 Friday 27-05-2112 Friday 26-05-2113
Output for 5.4.0 - 5.4.45, 5.5.24 - 5.5.35, 5.6.8 - 5.6.28, 7.0.0 - 7.0.20, 7.1.0 - 7.1.20, 7.2.5 - 7.2.33, 7.3.12 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.31, 8.2.0 - 8.2.26, 8.3.0 - 8.3.14
Friday 23-05-2014 Friday 22-05-2015 Friday 27-05-2016 Friday 26-05-2017 Friday 25-05-2018 Friday 24-05-2019 Friday 22-05-2020 Friday 28-05-2021 Friday 27-05-2022 Friday 26-05-2023 Friday 24-05-2024 Friday 23-05-2025 Friday 22-05-2026 Friday 28-05-2027 Friday 26-05-2028 Friday 25-05-2029 Friday 24-05-2030 Friday 23-05-2031 Friday 21-05-2032 Friday 27-05-2033 Friday 26-05-2034 Friday 25-05-2035 Friday 23-05-2036 Friday 22-05-2037 Friday 28-05-2038 Friday 27-05-2039 Friday 25-05-2040 Friday 24-05-2041 Friday 23-05-2042 Friday 22-05-2043 Friday 27-05-2044 Friday 26-05-2045 Friday 25-05-2046 Friday 24-05-2047 Friday 22-05-2048 Friday 28-05-2049 Friday 27-05-2050 Friday 26-05-2051 Friday 24-05-2052 Friday 23-05-2053 Friday 22-05-2054 Friday 28-05-2055 Friday 26-05-2056 Friday 25-05-2057 Friday 24-05-2058 Friday 23-05-2059 Friday 21-05-2060 Friday 27-05-2061 Friday 26-05-2062 Friday 25-05-2063 Friday 23-05-2064 Friday 22-05-2065 Friday 28-05-2066 Friday 27-05-2067 Friday 25-05-2068 Friday 24-05-2069 Friday 23-05-2070 Friday 22-05-2071 Friday 27-05-2072 Friday 26-05-2073 Friday 25-05-2074 Friday 24-05-2075 Friday 22-05-2076 Friday 28-05-2077 Friday 27-05-2078 Friday 26-05-2079 Friday 24-05-2080 Friday 23-05-2081 Friday 22-05-2082 Friday 28-05-2083 Friday 26-05-2084 Friday 25-05-2085 Friday 24-05-2086 Friday 23-05-2087 Friday 21-05-2088 Friday 27-05-2089 Friday 26-05-2090 Friday 25-05-2091 Friday 23-05-2092 Friday 22-05-2093 Friday 28-05-2094 Friday 27-05-2095 Friday 25-05-2096 Friday 24-05-2097 Friday 23-05-2098 Friday 22-05-2099 Friday 28-05-2100 Friday 27-05-2101 Friday 26-05-2102 Friday 25-05-2103 Friday 23-05-2104 Friday 22-05-2105 Friday 28-05-2106 Friday 27-05-2107 Friday 25-05-2108 Friday 24-05-2109 Friday 23-05-2110 Friday 22-05-2111 Friday 27-05-2112 Friday 26-05-2113
Output for 5.3.0 - 5.3.29
Parse error: syntax error, unexpected T_OBJECT_OPERATOR in /in/3cLIS on line 11
Process exited with code 255.
Output for 5.1.0 - 5.1.6, 5.2.0 - 5.2.17
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/3cLIS on line 6 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/3cLIS on line 9 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/3cLIS on line 11 Parse error: syntax error, unexpected T_OBJECT_OPERATOR in /in/3cLIS on line 11
Process exited with code 255.
Output for 5.0.0 - 5.0.5
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/3cLIS on line 6 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/3cLIS on line 9 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/3cLIS on line 11 Parse error: parse error, unexpected T_OBJECT_OPERATOR in /in/3cLIS on line 11
Process exited with code 255.
Output for 4.4.2 - 4.4.9
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/3cLIS on line 6 Parse error: syntax error, unexpected T_STRING, expecting ')' in /in/3cLIS on line 6
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.3.11, 4.4.0 - 4.4.1
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/3cLIS on line 6 Parse error: parse error, unexpected T_STRING, expecting ')' in /in/3cLIS on line 6
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/3cLIS on line 6 Parse error: parse error, expecting `')'' in /in/3cLIS on line 6
Process exited with code 255.

preferences:
87.35 ms | 419 KiB | 5 Q