Re: testing if var is empty

From: Date: Sat, 21 Jul 2001 09:50:41 +0000
Subject: Re: testing if var is empty
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-59008@lists.php.net to get a copy of this message
On Sat, 21 Jul 2001, Dave Freeman wrote: > On 21 Jul 01, at 12:07, Justin French wrote: > > > I'm a semi-newbie, and if I want to check if a variable is set, or > > contains something, i've been doing it like this: > > > > if($var != "") { ... } > > if ($var) > { > // $var has been set > } else { > // $var has not been set > } > > > will do what you want. > > CYA, Dave what if the var is set to zero i.e. false. the control will go in the else part if it is not zero ( not false) it will go in the if control. > > > ----------------------------------------------------------------------- > Outback Queensland Internet - Longreach, Outback Queensland - Australia > http://www.outbackqld.net.au > mailto:dfreeman@outbackqld.net.au > ----------------------------------------------------------------------- > > -- Saquib Farooq @ Systems @ SDNPK Islamabad

« previous php.general (#59008) next »