Reply to Re: [PHP] possible bug (string equality to zero)?

Your name:

Reply:


Posted by Chris Shiflett on 08/11/05 19:06

Christopher J. Bottaro wrote:
> Is it a bug that ($var == 0) is always true for any string $var?

For any string? How about the string 5? :-)

PHP tries to help you out, but there's not much it can do when you ask
it to compare a string like 'foo' to an integer. It scans your string
from left to right and uses the leading numbers to create the integer.
For example, 53chris is 53, but chris53 is 0 (no leading numbers).

Hope that helps.

Chris

--
Chris Shiflett
Brain Bulb, The PHP Consultancy
http://brainbulb.com/

[Back to original 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

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