Jordan,
http://www.php.net/manual/en/function.isset.php
When you do: if ($var)
you are saying if $var is boolean true
which is not what you say you want:
> Hi,
> If I want to test if a variable exists (or has been passed) then I just do:
>
Mohamed~
Jordan Elver wrote:
>
> Hi,
> If I want to test if a variable exists (or has been passed) then I just do:
>
> if($var) {
> // variable is here
> }
>
> But I've noticed that a lot of people do:
>
> if(isset($var)) {
> // variable is here
> }
>
> What's the difference and which is the best way?
>
> TIA,
>
> Jord
>
> --
> Jordan Elver
> while (!asleep()) sheep++;
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]