Код: Выделить всё
$images = scandir($dir);
$filestomove = array('home-accessories----candles.jpg');
$displayDates = array('25/12/2010', '26/12/2010');
p>
У меня проблемы с циклом.
Вот мой код:
Код: Выделить всё
$images = scandir($dir);
$images2 = array();
//array of filenames to move from images array
$filestomove = array('home-accessories----candles.jpg');
//creates date in the format of 15/12/2010
$format = 'd/m/Y';
// date of current day
$today = date($format);
//date display the ad
$displayDates = array('25/12/2010', '26/12/2010');
foreach ($displayDates as $key => $value){
if($today != $value){
//remove the filenames from the array and create new array
$images2 = array_diff($images, $filestomove);
//overwrite the old array with the new one
$images = $images2;
break;
}
}
Мне нужна помощь в этом цикле. Я не знаю, как проверить массив $displayDates и удалить элемент массива, только если сегодняшняя дата отсутствует в массиве.
Подробнее здесь: https://stackoverflow.com/questions/445 ... t-of-dates
Мобильная версия