|
Posted by Jerry Stuckle on 05/12/07 20:40
Andy Hassall wrote:
> On Sat, 12 May 2007 14:26:19 -0500, Jerry Stuckle <jstucklex@attglobal.net>
> wrote:
>
>> Andy Hassall wrote:
>>> On 12 May 2007 06:28:04 -0700, wbrowse@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.
Of course you're right... I should think more before replying... :-)
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
[Back to original message]
|