strcmp()?

From: Date: Mon, 23 May 2011 12:00:27 +0000
Subject: strcmp()?
Groups: php.general 
Request: Send a blank email to php-general+get-313090@lists.php.net to get a copy of this message
At 8:13 AM +0000 5/23/11, Ford, Mike wrote:
-----Original Message----- From: tedd [mailto:tedd.sperling@gmail.com]
On Sat, 21 May 2011 09:26:02 -0400, tedd wrote:
The function strcmp() simply evaluates two strings and reports
back -1, 0, or 1 depending upon their alphabetical relationship.
It might do that, but don't bet your horse on it. <http://se.php.net/manual/en/function.strcmp.php>
/Nisse It works that way for me.
Are you absolutely certain about that? echo strcmp('These are nearly equal', 'These are almost equal'), "\n"; echo strcmp('different', 'unequal'), "\n"; echo strcmp('b', 'a'), "<br />\n"; Result: 13 -17 1 The description of the function merely says that the result is <0, 0 or >0 -- it makes no promises about the actual value when it is non-zero. Mike
Mike: That's interesting. Try the same comparisons here: http://www.webbytedd.com/lcc/citw229/string-compare.php For me they are 1, -1, and 1. Someone with more smarts than me* will have to figure this one out. Cheers, tedd PS: * I can hear the peanut gallery saying "That won't be hard." :-) -- ------- http://sperling.com/

« previous php.general (#313090) next »