note 29456 deleted from function.empty by philip

From: Date: Wed, 26 Mar 2003 01:03:26 +0000
Subject: note 29456 deleted from function.empty by philip
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-45826@lists.php.net to get a copy of this message
<---- i havent quite figured out what system will work for testing "empty" variables .. i believe they are either !isset or they have something in them if isset=true.. -----> Look at this code : <?php ************** if (!isset($a)) { echo "the variable doesnt exist!"; } elseif (empty($a)) { echo "it exists but is empty!"; } else { echo "it exists and contains something!"; } ?> If you replace * with blank space, you get "the variable doesnt exist!" If you replace * with $a = 1; you get "it exists and contains something!" If you replace * with $a = array(); you get "it exists but is empty!"

« previous php.notes (#45826) next »