title: Get remaining dates from Array
body: <p>I have one leave array,(retrive from table)</p>
  
  <pre><code>$leavearray=array("2019-10-22","2019-10-23","2019-10-25","2019-10-26","2019-10-28","2019-10-30");
  </code></pre>
  
  <p>If I give 2,it should return next 2nd working day-2019-10-27
  If I give 1,it should return next 1st working day-2019-10-24
  Can you help me to get this.</p>
  
  <pre><code>$priority=2;
  $date="2019-10-22";
  echo $this-&gt;checknextdate($date,$priority);
  
  function checknextdate($date,$priority){ 
      $leavearray=array("2019-10-22","2019-10-23","2019-10-25","2019-10-26","2019-10-28","2019-10-30");
      do{
         if(in_array($date,$leavearray))
         {
             $date = date('Y-m-d', strtotime($date.'+1 day'));
         }else{
             return $date;
             $checkok=1;
             exit();
         }
       } while ($checkok==1); 
  }
  </code></pre>