lundi 1 février 2016

Is this the correct way of checking empty array?

I want to check if array is empty or not, i wrote few lines of code for it

if(array() == $myArray){
   echo "Array";
}

or

if(array() === $myArray){
   echo "Array";
}

I'm confused which one to use, as the second condition also checks type. But i think in the case of array we don't need to check their type. Please anybody can suggest me which one to use.

Aucun commentaire:

Enregistrer un commentaire