note 19166 rejected from function.strncmp by alindeman
| From: | alindeman@php.net | Date: | Mon, 18 Feb 2002 22:31:34 +0000 |
| Subject: | note 19166 rejected from function.strncmp by alindeman | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-26772@lists.php.net to get a copy of this message | ||
$str1 = "sample";
$str2 ="sam";
echo strncmp($str1, $str2, 2); ->0
echo strncmp($str1, $str2, 3); ->0
echo strncmp($str1, $str2, 4); ->1
echo strncmp($str1, $str2, 5); ->2
why? if the definition is correct, the 2 strings are equal in the long of the sort string, 3 chars.
why?