RE: [PHP] comparisons
| From: | PHPBeginner.com | Date: | Mon, 12 Feb 2001 09:41:48 +0000 |
| Subject: | RE: [PHP] comparisons | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-39186@lists.php.net to get a copy of this message | ||
try this first:
if((strlen($pick1)==strlen(pick2))and($pick1==$pick2))
echo 'they are equal';
else
echo 'they aren\'t at least in length';
However, it seens to me as a very slicky style ... whay not to make them
somehow different .... let's say using an array, or having a letter instead
of 0 ...
Sincerely,
Maxim Maletsky
Founder, Chief Developer
PHPBeginner.com (Where PHP Begins)
maxim@phpbeginner.com
www.phpbeginner.com
-----Original Message-----
From: Curtis Maurand [mailto:curtis@canon.maurand.com]
Sent: Monday, February 12, 2001 3:48 AM
To: php-general@lists.php.net
Subject: [PHP] comparisons
Hello,
I'm having a rather strange problem. I'm trying to compare two values.
"01" and "1". The variables names that they are submitted under are pick1
and pick2. i use the following code
$mypick1 = strval($pick1);
$mypick2 = strval($pick2);
I then perform the following comparison:
if ($mypick1 == $mypick2)
{
$error = 1;
$errorstring[1] = "Your first pick and second pick are the same.";
}
However, I get the error that they are equal.
If I call the comparison as foloows:
if(strval($mypick1) == strval($mypick2)
{
$error = 1;
$errorstring[1] = "Your first pick and second pick are the same.";
}
I still get the error. Anyone have any ideas? These two valuse mustbe
evaluated as different.
Thanks in advance
Curtis