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

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -