note 18479 added to language.operators.comparison
| From: | c dot hester at ukonline dot co dot uk | Date: | Thu, 24 Jan 2002 16:03:57 +0000 |
| Subject: | note 18479 added to language.operators.comparison | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-25782@lists.php.net to get a copy of this message | ||
If your strings are identical but include a space at the end, a comparison fails to return true!
I have a script that needs to split a string down into single words, remove one of them, then
rebuild it. Call me lazy, but the way I did it always has a space at the end because the number of
words to split down varies. I could not get the code to work until I added a line to strip out the
trailing space.
Of course there are many ways to solve this problem, but why does the comparison fall down when the
strings are exactly the same but with a space at the end?
--
http://www.php.net/manual/en/language.operators.comparison.php
http://master.php.net/manage/user-notes.php?action=edit+18479
http://master.php.net/manage/user-notes.php?action=delete+18479
http://master.php.net/manage/user-notes.php?action=reject+18479