Date: 08/08/00
- Next message: Daniel Convissor: "Re: [PHP] multi dimension form input"
- Previous message: Dan: "RE: [PHP] Fuzzy logic in PHP?"
- In reply to: Brian T. Allen: "[PHP] $VAR = 0 != false"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Heya:
"Brian T. Allen" wrote:
>
> One of the items has an option that is stored in the database as 0 (zero).
>
> if($VAR){
> echo $VAR;
> }
>
> You get nothing, even though the variable is set.
> It is set to zero, granted, but it is set!
>
> I can understand that in some types of tests you want 0 to be
> synonimous with false, but here I am only testing if the variable
> is set to a value, be it false, 0, or something else.
>
> I just tested, and isset() works like I think it should
You're right on target with what you're writing, but your not seeing it.
The IF statement IS a test. IF statements fail if the test comes out to 0.
So, since your variable is 0, the test fails.
The statement that you are "testing if the variable is set" is exactly what
you're trying to do, so use the isset() function.
Enjoy,
--Dan
--
T H E A N A L Y S I S A N D S O L U T I O N S C O M P A N Y
More than just answers. Solutions. (SM)
http://www.analysisandsolutions.com/
4015 7 Av #4, Brooklyn NY 11232 v: 718-854-0335 f: 718-854-0409
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-general-unsubscribe <email protected>
For additional commands, e-mail: php-general-help <email protected>
To contact the list administrators, e-mail: php-list-admin <email protected>
- Next message: Daniel Convissor: "Re: [PHP] multi dimension form input"
- Previous message: Dan: "RE: [PHP] Fuzzy logic in PHP?"
- In reply to: Brian T. Allen: "[PHP] $VAR = 0 != false"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

