RE: [PHP] comparing strings does not work
| From: | Jonathan Rosenberg | Date: | Tue, 11 Jun 2002 13:10:41 +0000 |
| Subject: | RE: [PHP] comparing strings does not work | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-101544@lists.php.net to get a copy of this message | ||
strcmp returns 0 if the two strings are equal.
In any case, why not just do
if ($city == $city_new) $error = true;
> -----Original Message-----
> From: andy [mailto:news.letters@gmx.de]
> Sent: Tuesday, June 11, 2002 9:10 AM
> To: php-general@lists.php.net
> Subject: [PHP] comparing strings does not work
>
>
> Hi there,
>
> I would like to compare 2 strings.
>
> I do always get a 0 return (not equal) but they are
> difinatelly equal, I
> double checked it. They are just in two different vars.
>
> Here is how I did it:
>
> if (strcmp($city, $city_new) != 0) $error = true;
>
> Does anybody see the error? Or am I going the wrong way?
>
> Andy
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>