You are here: Re: Wy in Php 01 is greater than 1 ? « PHP Programming Language « IT news, forums, messages
Re: Wy in Php 01 is greater than 1 ?

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
==================

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация