У меня возникла проблема с зацикливанием массивов и смешиванием их с новым набором данных. Первый набор массива — это идентификатор комнаты. Другой набор — диапазон дат. Я хотел бы зацикливать каждый день в диапазоне с идентификаторами комнат в массиве.
Вот мои ресурсы:
$_rid=array("5","6");
$date_range=getDays('2012-11-30','2012-12-05');
$_sid=md5(time());
Функция получения дат между двумя днями:
function getDays($strDateFrom,$strDateTo) {
// takes two dates formatted as YYYY-MM-DD and creates an
// inclusive array of the dates between the from and to dates.
// could test validity of dates here but I am already doing
// that in the main script
$aryRange=array();
$iDateFrom=mktime(1,0,0,substr($strDateFrom,5,2), substr($strDateFrom,8,2),substr($strDateFrom,0,4));
$iDateTo=mktime(1,0,0,substr($strDateTo,5,2), substr($strDateTo,8,2),substr($strDateTo,0,4));
if ($iDateTo>=$iDateFrom) {
array_push($aryRange,date('Y-m-d',$iDateFrom)); // first entry
while ($iDateFrom
Подробнее здесь: https://stackoverflow.com/questions/135 ... m-together