[Solved] how to remove set of dates from given date and return start and end end date using php [closed]


$dateArr = array();
$arr_1   = array();
$arr_2   = array();
$begin   = new DateTime('2013-01-01 00:00:00');
$end     = new DateTime('2016-02-18 23:59:59');
$daterange  = new DatePeriod($begin, new DateInterval('P1D'), $end);
foreach($daterange as $date){
   $arr_1[]=  $date->format("Y-m-d");
}
$condidateStart = new DateTime('2014-03-25 00:00:00');
$condidateEnd   = new DateTime('2014-10-15 23:59:59');
$daterange1    = new DatePeriod($condidateStart, new DateInterval('P1D'), $condidateEnd);
foreach($daterange1 as $date){
  $arr_2[] =  $date->format("Y-m-d");
}
$i=0;
$j=0;
$arrcount =  count($arr_1);
for ($m=0;$m<$arrcount;$m++) {
  if(in_array($arr_1[$m],$arr_2)) {
   if($i == 1) {
 $myDateArr[$j]['end'] = $arr_1[$m-1];
 $j = $j+1;
 $i=0;  
     $dateArr="";
   }        
 } 
else {
if($i == 0 || $m == $arrcount-1) { 
 if($m == $arrcount-1) { 
  $myDateArr[$j]['end'] = $arr_1[$m];
$j = $j+1;
 } 
else  {
  $myDateArr[$j]['start'] = $arr_1[$m]; 
$i=1; 
}
   $dateArr=""; 
 }
 }      
 }
echo"<pre>";print_r($myDateArr);

solved how to remove set of dates from given date and return start and end end date using php [closed]