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

Popular posts from this blog

twig - Using Twigbridge in a Laravel 5.1 Package -

jdbc - Not able to establish database connection in eclipse -

firemonkey - How do I make a beep sound in Android using Delphi and the API? -