note 28508 added to function.strncmp

From: Date: Wed, 15 Jan 2003 11:41:47 +0000
Subject: note 28508 added to function.strncmp
Groups: php.notes 
Request: Send a blank email to php-notes+get-42171@lists.php.net to get a copy of this message
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); } -- http://www.php.net/manual/en/function.strncmp.php http://master.php.net/manage/user-notes.php?action=edit+28508 http://master.php.net/manage/user-notes.php?action=delete+28508 http://master.php.net/manage/user-notes.php?action=reject+28508

« previous php.notes (#42171) next »