note 23496 added to language.operators.comparison
| From: | arthur at do dot not dot spam dot batman dot is | Date: | Fri, 19 Jul 2002 15:24:24 +0000 |
| Subject: | note 23496 added to language.operators.comparison | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-33311@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 to agree with aaron here. Space isn't just "nothing", though it may seem so on
paper. A space has an ascii value just like any other character and takes up exactly the same amount
of memory and should therefore never be considered "nothing" og "null". Or our
more natural language:
(' ' == chr(32)) && (' ' > null) && strlen(' ') ==
1
It is a good habit to trim() all user input like Aaron mentioned, although I myself am way too lazy
for that.
Arthur
--
http://www.php.net/manual/en/language.operators.comparison.php
http://master.php.net/manage/user-notes.php?action=edit+23496
http://master.php.net/manage/user-notes.php?action=delete+23496
http://master.php.net/manage/user-notes.php?action=reject+23496