Links to know aboutMusic The Chiara String Quartet Chiara Quartet (MySpace) Greenwood Music Camp UNL School of Music PHP PEAR Installer Manifesto phpDocumentor PEAR phar docblock PHP_Parser PHP_Parser_DocblockParser PHP_ParserGenerator PHP_LexerGenerator PEAR_PackageFileManager PHP_Archive Games_Chess Blogs Joshua Eichorn Paul M. Jones Davey Shafik Popular EntriesSetting up your own PEAR channel with Chiara_PEAR_Server - the official way
(26) Do you develop a website? It is infinitely better to synchronize live and development sites using the PEAR Installer(24) Using PEAR 1.4.0 to install PEAR packages on a remote host(19) doing the PEAR thing(19) PEAR now fits in a bottle: meet go-pear.phar(17) CategoriesPowered by |
Thursday, December 15. 2005comparing strings in PHP with the == operatorComments
Display comments as
(Linear | Threaded)
As you noted, this example returns TRUE:
var_dump('01' == 1); You'd think that's reasonable, but the real inconsistency is shown by this example: var_dump('010' == 010); This returns FALSE. The former evaluates to decimal, and the latter to octal.
I think the comparison of '01' == 1 should be exact, the existing comparison should be done by something like '01' eq 1
I also believe that new users are confused about it, it is not easier and not pedagogically useful. |
PEAR Installer ManifestoCalendar
QuicksearchMy Latest ReleasesTop Exitspear.php.net (312)
www.php.net (121) pecl.php.net (91) pear.chiaraquartet.net (60) cvs.php.net (34) Blog Administration |
|||||||||||||||||||||||||||||||||||||||||||||||||
由于PHP是一种弱类型的语言,也就是说数据类型这个概念在PHP中被弱化。因而如果在编程时过分忽略数据类型(也是大部份PHP程序员的通病),会产生一些问题,甚至导致安全漏洞……
Tracked: Dec 19, 04:17
Me encontre con este post y me parecio que le podia llegar a ahorrar a alguien horas de dolores de cabeza. En resumen es una comparacion en la que PHP no compara como uno esperaria, y tendriamos que usar “===” (forzar chequeo de tipo de da...
Tracked: Dec 19, 11:32