RE: [PHP] make a variable not exist?

From: Date: Fri, 13 Jun 2003 09:20:35 +0000
Subject: RE: [PHP] make a variable not exist?
Groups: php.general 
Request: Send a blank email to php-general+get-151341@lists.php.net to get a copy of this message
> -----Original Message----- > From: Amanda McComb [mailto:amccomb@indiana.edu] > Sent: 12 June 2003 22:21 > > Is there a way to make a variable not exist? There are several places > where I test (!$variable), and I want to be able to change the > variable to pass that test, even though it exists, under certain > circumstances. Well, the following values will all cause that test to succeed: 0 0.0 '' '0' array() FALSE NULL so take your pick! Personally, I tend to use NULL in this situation, because it fails isset(), is detectable with is_null(), and, crucially, doesn't generate a notice on doing if($variable). Cheers! Mike --------------------------------------------------------------------- Mike Ford, Electronic Information Services Adviser, Learning Support Services, Learning & Information Services, JG125, James Graham Building, Leeds Metropolitan University, Beckett Park, LEEDS, LS6 3QS, United Kingdom Email: m.ford@lmu.ac.uk Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211

« previous php.general (#151341) next »