How to check if array is empty in PHP

1 Answer

0 votes
$arr1 = array('php' => 'programming'); 
$arr2 = array(); 
  
if (!empty($arr1)) 
    echo "Not empty\n"; 
  
if (empty($arr2)) 
    echo "Empty"; 
    
    

/*
run:

Not empty
Empty

*/

 



answered Aug 23, 2020 by avibootz

Related questions

1 answer 254 views
3 answers 413 views
3 answers 428 views
5 answers 1,225 views
3 answers 665 views
665 views asked Apr 13, 2015 by avibootz
1 answer 333 views
...