如何计算条件中的数组:
$array = array(
'2018/11/24',
'2018/11/25',
'2018/12/1',
'2018/12/2',
'2018/12/3'
); //specified date
$start = strtotime('2018/11/23');
$then = strtotime('2018/11/26');
如何计算符合
的数组criteria >= $start and <=$then
答案 0 :(得分:0)
将foreach循环用作第一次尝试:
$array = array(
'2018/11/24',
'2018/11/25',
'2018/12/1',
'2018/12/2',
'2018/12/3'
);
$start = strtotime('2018/11/23');
$then = strtotime('2018/11/26');
foreach ($array as $date)
strtotime($date) >= $start && strtotime($date) <= $then and $count++;
echo "$count elements matches criteria";