You are here: Re: [PHP] Re: Comparison Operator « PHP « IT news, forums, messages
Re: [PHP] Re: Comparison Operator

Posted by John Nichel on 10/04/91 11:05

Jason Morehouse wrote:
>
> Russell Chadwick wrote:
>
>>
>> Could anyone tell me why this code echos?
>>
>> <?php
>> $value = 0;
>> $curval = 'A';
>> if ($value == $curval) {
>> echo "WTH, Over<br>";
>> }
>> ?>
>
>
> $value = 0 means false. And your comparison is false. Try:

If the comparison is false, the echo shouldn't be executed.

This if statement is evaluating to true, because...

"If you compare an integer with a string, the string is converted to a
number."

http://us4.php.net/manual/en/language.operators.comparison.php

<snip>

--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
john@kegworks.com

 

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

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