Re: [PHP] comparison operator

2005-03-09 Thread Jason Barnett
Richard Lynch wrote: >>i ran into this problem and i dont remember how i worked around it. > > > http://php.net/isset > > I would also use isset. Or you can use the identical (===) comparison instead of the equivalent (==) comparison to check for 0. -- Teach a man to fish... NEW? | http://www.c

Re: [PHP] comparison operator

2005-03-09 Thread Richard Lynch
> i ran into this problem and i dont remember how i worked around it. http://php.net/isset > if($_REQUEST['value'] == 1) > { > // do something > } > else if($_REQUEST['value'] == 0) > { > // do something > } > > even if i don't do ?value=0 its always prints something.. i want to make > an > on

[PHP] comparison operator

2005-03-09 Thread Sebastian
i ran into this problem and i dont remember how i worked around it. if($_REQUEST['value'] == 1) { // do something } else if($_REQUEST['value'] == 0) { // do something } even if i don't do ?value=0 its always prints something.. i want to make an on/off value based on the value of the url.. 1 for

RE: [PHP] Comparison Operator

2005-01-11 Thread Ford, Mike
To view the terms under which this email is distributed, please go to http://disclaimer.leedsmet.ac.uk/email.htm On 10 January 2005 21:20, Chadwick, Russell wrote: > The function this is from sometimes uses $_POST or $_GET input, so > sometimes its comparing 1337 with '1337' and === would brea

RE: [PHP] Comparison Operator

2005-01-10 Thread Richard Lynch
Chadwick, Russell wrote: > > The function this is from sometimes uses $_POST or $_GET input, so > sometimes its comparing 1337 with '1337' and === would break that. > > so I'll have to use something like: > > if (($value == $curval) && !(is_string ($curval) && ($value == 0))) > > unless there is a

RE: [PHP] Comparison Operator

2005-01-10 Thread Chadwick, Russell
unless there is a better way From: Brad Pauly [mailto:[EMAIL PROTECTED] Sent: Mon 2005-01-10 11:41 To: Chadwick, Russell Cc: php-general@lists.php.net Subject: Re: [PHP] Comparison Operator On Mon, 10 Jan 2005 10:26:16 -0800, Chadwick, Russell <[EMAIL PROTECTED]> wrote: &

Re: [PHP] Comparison Operator

2005-01-10 Thread Brad Pauly
On Mon, 10 Jan 2005 10:26:16 -0800, Chadwick, Russell <[EMAIL PROTECTED]> wrote: > > Could anyone tell me why this code echos? > > $value = 0; > $curval = 'A'; > if ($value == $curval) { > echo "WTH, Over"; > } > ?> The string is converted to an integer when compared with an integer. See

Re: [PHP] Comparison Operator

2005-01-10 Thread trobi
Chadwick, Russell wrote / napĂ­sal (a): Could anyone tell me why this code echos? "; } ?> Try === If you use == $value is compared to $curval $value is integer so php converts $curval to integer so it contains no digtis so it assumes that $curval=0; why it is. trobi -- PHP General Mailing List

Re: [PHP] Comparison Operator

2005-01-10 Thread tg-php
Ahh.. the trick question. hah.. Ok, let me see if I remember this (although it doesn't seem to follow the logic in my head.. I know someone else will explain it better but let me take a crack at it): When comparing a two different variable types that PHP thinks it knows how to compare, it will

RE: [PHP] Comparison Operator

2005-01-10 Thread Jay Blanchard
[snip] Could anyone tell me why this code echos? "; } ?> [/snip] Because it has an echo statement in it. And '==' is not '===' >From http://us3.php.net/manual/en/language.operators.comparison.php "If you compare an integer with a string, the string is converted to a number. If you compare two

[PHP] Comparison Operator

2005-01-10 Thread Chadwick, Russell
Could anyone tell me why this code echos? "; } ?>

Re: [PHP] Comparison Operator

2004-07-01 Thread Curt Zirzow
* Thus wrote Michael Sims: > Gabe wrote: > > I was looking at the comparison operators page and noticed that these > > two operators were listed as "PHP4 only". Is that an error, or are > > they really not used in PHP5? I don't want to use them if they're > > going to break when I upgrade. And i

Re: [PHP] Comparison Operator

2004-07-01 Thread Gabe
Michael Sims wrote: Gabe wrote: I was looking at the comparison operators page and noticed that these two operators were listed as "PHP4 only". Is that an error, or are they really not used in PHP5? I don't want to use them if they're going to break when I upgrade. And if they aren't included, t

RE: [PHP] Comparison Operator

2004-07-01 Thread Michael Sims
Gabe wrote: > I was looking at the comparison operators page and noticed that these > two operators were listed as "PHP4 only". Is that an error, or are > they really not used in PHP5? I don't want to use them if they're > going to break when I upgrade. And if they aren't included, then > does s

[PHP] Comparison Operator

2004-07-01 Thread Gabe
I was looking at the comparison operators page and noticed that these two operators were listed as "PHP4 only". Is that an error, or are they really not used in PHP5? I don't want to use them if they're going to break when I upgrade. And if they aren't included, then does something else repl