<meta http-equiv="content-type" content="text/html; charset=utf-8" />

<?php 

	function _formatDate($date) {
  	// La date sort de la base en AAAA-MM-JJ, on transforme en JJ/MM/AAAA
  	return ereg_replace("([0-9]{4})-([0-9]{2})-([0-9]{2})", "\\3/\\2/\\1", $date);
  }

    function nbJours($debut, $fin) {
        //60 secondes X 60 minutes X 24 heures dans une journée
        $nbSecondes= 60*60*24;
 
        $debut_ts = strtotime($debut);
        $fin_ts = strtotime($fin);
        $diff = $fin_ts - $debut_ts;
        return round($diff / $nbSecondes);
    }
 
function reconstitution($date)
{
  $date_explose = explode("-", $date);
  $jour = $date_explose[0];
  $mois = $date_explose[1];
  $annee = $date_explose[2];
  $tmp = $jour ."-" .$mois;
  return $tmp;
}

  $date_debut = "28-10-2014";
 $date_fin = "23-10-2014";
 
 $ts = strtotime('date_debut');
 $ts = $ts + 3600 *24;
 //print(date('Y-m-d', $ts));
 
 echo "<br/>";
 echo "<br/>";
 
 $array = array();
 

 
 $nb_jour = 7;
 
 echo " Location de " .$nb_jour ." jours"; 
 echo "<br/>";
 echo "Arrivée :" .$date_debut;  
 echo "<br/>";
 
 $array[] = reconstitution($date_debut);
 
 for ($i = 1; $i <= $nb_jour; $i++)
 {
   $date = date("d-m-Y", strtotime($date_debut." +1 days"));
   $val = reconstitution($date);
   $array[] = reconstitution($date);
   $date_debut = $date;
   if($i == $nb_jour)
   { echo "Départ :" . $date;
   }
   else {
		  print $val;
		  }
 /* else {$date_debut = $date;
  $array[] = $date;
   print $date;
   }*/
   
   echo "<br/>";
}
 
 print_r($array);
 
 echo "<br/>";
 echo "<br/>";
 
 
 
 $date_explose = explode("-", $date_debut);
 $jour_debut = $date_explose[0];
 $mois_debut = $date_explose[1];
 $annee_debut = $date_explose[2];
 
 $date_explose = explode("-", $date_fin);
 $jour_fin = $date_explose[0];
 $mois_fin = $date_explose[1];
 $annee_fin = $date_explose[2];
 
 echo $jour_debut ." " .$mois_debut . " " .$annee_debut;
 echo "<br/>";
 echo $jour_fin ." " .$mois_fin . " " .$annee_fin;
 
 echo nbJours($date_debut, $date_fin).' jours';

	
	

//This gets today's date
$date =time () ;

//This puts the day, month, and year in seperate variables
$day = date('d', $date) ;
$month = date('m', $date) ;
$year = date('Y', $date) ;

//Here we generate the first day of the month
$first_day = mktime(0,0,0,$month, 1, $year) ;

//This gets us the month name
$title = date('F', $first_day) ; 

//print $title;

?>