3v4l.org

run code in 300+ PHP versions simultaneously
<?php function dates_in_consecutive_range(string $start_date, string $end_date, array $dates_list): bool { // If in consecutive range without missing days (holes), return true, else return false // If either $start_date or $end_date or both is not in $dates_list, return false return false; } $dates_list = [ '2022-03-11', '2022-03-12', '2022-03-13', '2022-03-14', '2022-03-18', '2022-03-19', ]; $start_date = '2022-03-11'; $end_date = '2022-03-14'; var_dump(dates_in_consecutive_range($start_date, $end_date, $dates_list)); // true $start_date = '2022-03-11'; $end_date = '2022-03-18'; var_dump(dates_in_consecutive_range($start_date, $end_date, $dates_list)); // false $start_date = '2022-03-18'; $end_date = '2022-03-19'; var_dump(dates_in_consecutive_range($start_date, $end_date, $dates_list)); // true $start_date = '2022-03-19'; $end_date = '2022-03-20'; var_dump(dates_in_consecutive_range($start_date, $end_date, $dates_list)); // false ($end_date not in $dates_list)
Output for 8.1.3 - 8.1.33, 8.2.10 - 8.2.29, 8.3.0 - 8.3.28, 8.4.1 - 8.4.14, 8.5.0
bool(false) bool(false) bool(false) bool(false)
Output for 8.4.15
/bin/php-8.4.15: /usr/lib/libm.so.6: version `GLIBC_2.38' not found (required by /bin/php-8.4.15) /bin/php-8.4.15: /usr/lib/libm.so.6: version `GLIBC_2.35' not found (required by /bin/php-8.4.15) /bin/php-8.4.15: /usr/lib/libc.so.6: version `GLIBC_2.34' not found (required by /bin/php-8.4.15) /bin/php-8.4.15: /usr/lib/libc.so.6: version `GLIBC_2.38' not found (required by /bin/php-8.4.15)
Process exited with code 1.

preferences:
104.82 ms | 407 KiB | 5 Q