Re: empty variable
| From: | Pat | Date: | Mon, 20 Sep 2004 02:45:42 +0000 |
| Subject: | Re: empty variable | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-197234@lists.php.net to get a copy of this message | ||
So, you have to know, first, what is your meaning of your empty variabe:
null, 0, "", array()?
For example, "$var = 0;", empty($var) says true... but you?
"Jason Davidson" <jdavidson@zworg.com> wrote in message
news:8752.1095640515@zworg.com...
> as suggeted the isset and empty functions are usefull,
> or if you know it may be set, but could be empty, how about just
> if($variable) {
>
> }
>
> that is the same as
> if($var == "")
>
> "Chris Mach" <cjmach@gto.net> wrote:
> >
> > What is the best way to determine if a variable is empty?
> >
> > I have a feeling there is a better way than the way I'm doing it now...
> >
> > if ($variable == "")
> >
> >
> > ---
> > Outgoing mail is certified Virus Free.
> > Checked by AVG anti-virus system (http://www.grisoft.com).
> > Version: 6.0.766 / Virus Database: 513 - Release Date: 18-Sep-2004