Re: strcmp()?
| From: | Vitalii Demianets | Date: | Tue, 24 May 2011 07:48:42 +0000 |
| Subject: | Re: strcmp()? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-313128@lists.php.net to get a copy of this message | ||
On Monday 23 May 2011 15:00:27 tedd wrote:
> >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";
My result is:
13 -17 1
I'm runninng PHP 5.2.14 on the ARM Linux with uClibc.
Certainly the result depends on architecture and/or libc, because PHP just
calls system strcmp, nothing more.
So. to write compatible scripts one should check "< 0", not "== -1".
--
With Best Regards,
Vitalii Demianets
Head engineer
Factor-SPE
Kiev, Ukraine
tel/fax: +380(44)249-21-63