note 21583 added to language.operators.comparison
| From: | aaron_hillyer at hotmail dot com | Date: | Sat, 18 May 2002 00:14:19 +0000 |
| Subject: | note 21583 added to language.operators.comparison | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-30777@lists.php.net to get a copy of this message | ||
c.hester@ukonline.co.uk wrote:
"If your strings are identical but include a space at the end, a comparison
fails to return true!"
Believe it or not, this is a "feature" and is standard in every language that I've
seen. Identical strings not only match each other but have the same LENGTH.
Thus, "string" is never identical to "string " because the length of the latter
is one more than the previous.
This has never been a problem with me in any other language and I don't anticipate it with PHP
(I'm just learning it, hence the reading of the manual). I always strip leading and trailing
space automatically when a user inputs the value of a variable.
--
http://www.php.net/manual/en/language.operators.comparison.php
http://master.php.net/manage/user-notes.php?action=edit+21583
http://master.php.net/manage/user-notes.php?action=delete+21583
http://master.php.net/manage/user-notes.php?action=reject+21583