note 21583 deleted from language.operators.comparison by sniper
| From: | sniper@php.net | Date: | Mon, 13 Oct 2003 00:16:47 +0000 |
| Subject: | note 21583 deleted from language.operators.comparison by sniper | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-58433@lists.php.net to get a copy of this message | ||
Note Submitter: aaron_hillyer@hotmail.com
----
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.