On Sat, 12 May 2007 14:26:19 -0500, Jerry Stuckle <js*******@attglobal.net>
wrote:
>Andy Hassall wrote:
>On 12 May 2007 06:28:04 -0700, wb*****@gmail.com wrote:
>>Wy in Php 01 is greater than 1 ?
It isn't. But perhaps you meant something else?
Maybe he mean '01' is bigger than ' 1'. It would be.
But even then:
$ php -r "var_dump('01' ' 1');"
bool(false)
$ php -r "var_dump('01' < ' 1');"
bool(false)
You have to get down to strcmp() to start showing up a difference, which
strays even further from what the OP posted.
$ cat test.php
<?php
$a = array('01', ' 1', '1');
sort($a);
print join("\n", $a);
?>
$ php test.php
1
1
01
So, back to the OP to clarify what he's on about... but certainly the sort
results above are a reasonable cause for confusion unless you get your head
around exactly when PHP does implicit type conversions.
--
Andy Hassall ::
an**@andyh.co.uk ::
http://www.andyh.co.uk http://www.andyhsoftware.co.uk/space :: disk and FTP usage analysis tool