You are here: Re: Some strings are not true ? « PHP Programming Language « IT news, forums, messages
Re: Some strings are not true ?

Posted by Tim Roberts on 12/31/07 21:53

groups2@reenie.org wrote:
>
>This is true: "2-3"==1
>
>But "1-2"==1 is not true
>
>Why ?

I get exactly the opposite results with the antique PHP 4.1.2 on my Linux
system.

What's happening here is that PHP tries to convert the string to an integer
for the comparison, and that conversion stops at the first non-digit (the
"-").

So, converting "2-3" produces the integer 2, and converting "1-2" produces
the integer 1.
--
Tim Roberts, timr@probo.com
Providenza & Boekelheide, Inc.

 

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

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