3v4l.org

run code in 300+ PHP versions simultaneously
<?php $delivery = array( 'next' => 1, 'max' => 2, 'exclude' => array(6 => "Samstag", 7 => "Sonntag"), 'afterhour' => 14, 'message' => "Lieferung bis %tomorrow% (%tomorrow_date_full%) oder %dayaftertomorrow% (%dayaftertomorrow_date_full%)", 'translate' => array('tomorrow' => 'morgen', 'dayaftertomorrow' => 'übermorgen'), 'date' => date("d.m.Y")); function checkWeekend($delivery) { $wochentage = array( 1=>"Montag", 2=>"Dienstag", 3=>"Mittwoch", 4=>"Donnerstag", 5=>"Freitag", 6=>"Samstag", 7=>"Sonntag"); $currentDay = (int) date('N'); $found = []; while(count($found) < 2) { $currentDay = $currentDay + 1; if(isset($delivery['exclude'][$currentDay])) { $found[] = $wochentage[$currentDay]; } } var_dump($found); } checkWeekend($delivery); ?>

preferences:
57.71 ms | 402 KiB | 5 Q