Reply to Re: Who thought this was a good idea?

Your name:

Reply:


Posted by Chris Hope on 11/11/27 11:18

Paul Wellner Bou wrote:

> Chris Hope wrote:
>> mrbog wrote:
>>> if (0 == 'asdfasdf' ) echo 'WHAT THE FUCK??????????';
>>
>> I posted something about this the other day.
>>
>> When comparing a string with a number the string is first evaluated
>> as a number, which in the case of the above is example is 0. So in
>> effect you are comparing 0 with 0.
>
> Sorry, this is not correct. The string and the number will be casted
> to a boolean value. And a non empty string is definitly true. 0 will
> be casted to false.

It is correct. It's in the manual. Check the first example in the code
block at the following manual page:
http://www.php.net/manual/en/language.operators.comparison.php

If you were right, then the above code snippet would not output the
text. Try running the code; it *does* output the text.

[rest of comments snipped]

--
Chris Hope | www.electrictoolbox.com | www.linuxcdmall.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

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