lundi 2 juillet 2018

Identical statement condition

Correct me if I'm wrong. I saw many people write condition header as this format.

if(isset($var) && $var!=""){}

Basically it just checking if $var isn't null value right? In my understanding this would be enough.

if($var){}

Am I missing something? Did my method unreliable? My colleague already pointed out that I should use the first one. Sometime I just lazy to write so I just want to make it simple.

Aucun commentaire:

Enregistrer un commentaire