How to check if an array is empty in PHP(Codeigniter) -
here it's sample of code :
public function show($imei,$start_time,$end_time,$dateto) { $from_time = str_replace('-','/',$start_time); $fromi=strtotime($from_time . ' ' . $end_time); $too1=strtotime($from_time . ' ' . $dateto); $data['coordinates'] = $this->road_model->get_coordinatesudhetime($imei, $fromi, $too1); $this->load->view('road/show', $data); if (!empty($data)) { echo 'array it's empty*'; } }
i want check when $data it's empty .
if (empty($data)) { echo "array empty"; } else { echo "not empty"; }
or count($data)
returns size of array.
Comments
Post a Comment