You are here: Re: Advice for an asp developer « PHP Programming Language « IT news, forums, messages
Re: Advice for an asp developer

Posted by Geoff Berrow on 07/05/06 10:39

Message-ID: <4h19smF1ldsruU1@individual.net> from Paul Lautman contained
the following:

>Could you explain your statement
>
>> can't do if( Astring == Bstring) must use strcmp()
>
>I often compare strings in an if statement?

So do I. It may be something to do with this:

http://uk.php.net/strcmp

From the user notes...

When we make a comparison with == php automaticly converts strings to
integers when either side of the comparison is an integer, f.e.:
<?
$value = 0;
if($value == "submit") {
echo "Let's submit";
}
?>
Above would be succesful, since "submit" is converted to an integer (eq
0) and the equation is would return true; (that's why (1 == "1submit")
would also return true)

That's why we should use strcmp or === (checks type also), for string
comparisons.
--
Geoff Berrow (put thecat out to email)
It's only Usenet, no one dies.
My opinions, not the committee's, mine.
Simple RFDs http://www.ckdog.co.uk/rfdmaker/

 

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

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