Re: strcmp()?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



At 11:10 AM -0700 5/24/11, David Harkness wrote:
On Tue, May 24, 2011 at 12:48 AM, Vitalii Demianets <vitas@xxxxxxxxxxxxxxxxx
 wrote:

 So. to write compatible scripts one should check "< 0", not "== -1".


Which matches the documentation:

    Returns < 0 if str1 is less than str2; > 0 if str1 is greater than str2,
and 0 if they are equal.

David

David:

I think the point here is that the documentation says the function returns a number greater than zero, or less than zero, or zero.

It's just that many who have responded on this list show that the function commonly returns -1, 1, and 0.

It's wise to keep with the documentation.

Cheers,

tedd

--
-------
http://sperling.com/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux