note 32091 added to function.strcmp
| From: | shovan at nyetspam dot sanelane dot com | Date: | Fri, 16 May 2003 03:15:15 +0000 |
| Subject: | note 32091 added to function.strcmp | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-48093@lists.php.net to get a copy of this message | ||
If all you want to do is find out if two strings are the same or not, but do not care if one is
"greater" or "less" than the other, then the == operator is about 60% faster
than the strcmp() call. That is, for speed, do this:
if ($var1 == $var2)
Instead of this:
if (strcmp($var1, $var2) == 0)
--
http://www.php.net/manual/en/function.strcmp.php
http://master.php.net/manage/user-notes.php?action=edit+32091
http://master.php.net/manage/user-notes.php?action=delete+32091
http://master.php.net/manage/user-notes.php?action=reject+32091