phparrayscodeigniter

How to check the value of an array in codeigniter


$result = array();
$count = count($days);
for ($i = 0; $i < $count - 1; $i++){
    $bookDate = $days[$i];
    $fromDate = $this->booking_model->Get_BookedDate($bookDate, $roomname);
    if ($fromDate != 0) {
        $result[] = $bookDate;  
    }                   
}
return $result; 

This is my codeigniter controller function here I want to check the value of $fromDate is zero or not. I am getting the array like this

Array (
    [0] => Array (
        ["2013-04-27" between fromDate and toDate] => 1
    )
)

Solution

  • $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;