note 46999 added to function.strcmp
| From: | x123atbestof-interdotnet at osu1 dot php dot net | Date: | Sat, 30 Oct 2004 01:43:51 +0000 |
| Subject: | note 46999 added to function.strcmp | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-79340@lists.php.net to get a copy of this message | ||
Please tell what you mean by "alphabetically" and when you say
"because of the way it works, it is not very useful..." or
"I get strange results, 1 for strings that are equal, etc." :
give an example where it does not work and/or show where your script works better!
(To test some PHP code, it is sufficient to have a file of 3 lines:
<form action='' method=POST><input type=submit value=Evaluate>
<textarea id=c><?=$c=stripslashes($_POST['c'])?></textarea>
<br>Result of the above:<pre><?=eval($c)?></pre></form>)
Imagine how much time is lost for visitors trying to figure out what your program does differently
from strcmp ?
Imagine how much resources are wasted if PHP users are made to think that PHP functions don't
work well and use the EXTREMELY inefficient routines proposed below (e.g. a string comparision
routine that uses substr(...,$i,1) to access individual caracters...!)
If the documentation says 'binary safe' this should mean that strings are compared byte by
byte (according to internal format)
- if strcmp() does instead use locale collation tables, this should be clearly mentioned in the
documentation.
----
Manual Page -- http://www.php.net/manual/en/function.strcmp.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+46999
Delete -- http://master.php.net/manage/user-notes.php?action=delete+46999&report=yes
Reason: bad code -- http://master.php.net/manage/user-notes.php?action=delete+46999&report=yes&reason=bad+code
Reason: spam -- http://master.php.net/manage/user-notes.php?action=delete+46999&report=yes&reason=spam
Reason: useless example -- http://master.php.net/manage/user-notes.php?action=delete+46999&report=yes&reason=useless+example
Reason: contains commercial links -- http://master.php.net/manage/user-notes.php?action=delete+46999&report=yes&reason=contains+commercial+links
Reason: useless note -- http://master.php.net/manage/user-notes.php?action=delete+46999&report=yes&reason=useless+note
Reject -- http://master.php.net/manage/user-notes.php?action=reject+46999&report=yes
Search -- http://master.php.net/manage/user-notes.php