Arrays 如何在codeigniter中检查数组的值
我对codeigniter很陌生。谢谢您的帮助。使用Arrays 如何在codeigniter中检查数组的值,arrays,codeigniter,Arrays,Codeigniter,我对codeigniter很陌生。谢谢您的帮助。使用empty()函数 Array ( [0] => Array ( ["2013-04-27" between fromDate and toDate] => 1 ) ) 试试这个。$result=array(); if (!empty($fromDate)) { $result[] = $bookDate; } $count=计数(天); 对于($
empty()
函数
Array ( [0] => Array ( ["2013-04-27" between fromDate and toDate] => 1 ) )
试试这个。$result=array();
if (!empty($fromDate))
{
$result[] = $bookDate;
}
$count=计数(天);
对于($i=0;$ibooking\u model->Get\u BookedDate($bookDate,$roomname);
如果(!empty($fromDate[0][''.$bookDate'.''介于fromDate和toDate']))
{
$result[]=$bookDate;
}
}
返回$result;
试试这个。这可能会帮助您为什么在foreach循环中进行比较只在外部进行比较,并且您是否确定只有一个日期输出匹配…………感谢您的回复如果数组([0]=>Array([[fromDate和toDate之间的[2013-04-27]=>0])和数组([0]=>Array([“2013-04-27”)正在执行循环fromDate和toDate之间]=>1))如果数组值为1,则执行该语句;如果数组值为0,则不执行该语句。我已修复该问题。感谢您的帮助
if(!empty($fromdate)) { //if $formdate is empty or 0 or false the loop won't be executed
//Your code.
}
if (!empty($fromDate))
{
$result[] = $bookDate;
}
$result=array();
$count = count($days);
for($i=0;$i<$count-1; $i++)
{
$bookDate = $days[$i];
$fromDate = $this->booking_model->Get_BookedDate($bookDate,$roomname);
if (!empty($fromDate[0]['"'.$bookDate.'" between fromDate and toDate']))
{
$result[] =$bookDate;
}
}
return $result;