note 28508 deleted from function.strncmp by aidan
| From: | aidan@php.net | Date: | Tue, 28 Jun 2005 10:35:42 +0000 |
| Subject: | note 28508 deleted from function.strncmp by aidan | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-91081@lists.php.net to get a copy of this message | ||
Note Submitter: Jules
----
To do this on a system where this function is not available you could use code like the following:
function my_strncmp($cmp1, $cmp2, $limit)
{
if (strlen ($cmp1) > $limit)
$cmp1 = substr($cmp1, 0, $limit);
if (strlen ($cmp2) > $limit)
$cmp2 = substr($cmp2, 0, $limit);
return strcmp ($cmp1, $cmp2);
}