note 46128 added to function.strcmp

From: Date: Thu, 30 Sep 2004 07:12:53 +0000
Subject: note 46128 added to function.strcmp
Groups: php.notes 
Request: Send a blank email to php-notes+get-77606@lists.php.net to get a copy of this message
I find that spaces are ignored while making the string comparision. That is, strcmp("abc ", "abc") returns 0. If you want to avoid that, you can use something like the following: <?php function strcmp_s($s1, $s2) { return strcmp("a".$s1."a", "a".$s2."a"); } ?> ---- Manual Page -- http://www.php.net/manual/en/function.strcmp.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+46128 Delete -- http://master.php.net/manage/user-notes.php?action=delete+46128&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+46128&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#77606) next »