Edit report at https://bugs.php.net/bug.php?id=44990&edit=1
ID: 44990 Updated by: ni...@php.net Reported by: design at apostolstudio dot com Summary: array('word')==array(0) -- true Status: Not a bug Type: Bug Package: Scripting Engine problem Operating System: Windows XP PHP Version: 5.2.6 Block user comment: N Private report: N New Comment: @radamanf: He is comparing with == so all array elements are also compared with ==. And as in PHP 'word'==0 they are considered equal. Are you suggesting that when you compare arrays with == the elements should be compared with ===? That makes no sense to me. Previous Comments: ------------------------------------------------------------------------ [2013-02-14 17:14:35] radamanf at gmail dot com Related To: Bug #39579 ------------------------------------------------------------------------ [2013-02-14 16:59:12] radamanf at gmail dot com Comparison === needed ONLY if, during type conversion, we got same values, so String compare to Integer should be compared using Integer converted to string and check if they are equal. So if String is '' and Int is 0 or '1' == 1 '2' == 2 .. etc. only in this cases === is necessary to tell VARIABLE TYPE difference. It's so obvious, why I'm explaining all this to you ?! You should know this better than me! Please fix this BUG ------------------------------------------------------------------------ [2008-05-14 02:58:01] design at apostolstudio dot com Thanks for explanations. ------------------------------------------------------------------------ [2008-05-14 02:39:53] cel...@php.net use === 'word' is converted to an integer for the comparison, and thus 0 == 0. try this code: if(array('word')===array(0)) echo "ERROR"; ------------------------------------------------------------------------ [2008-05-14 02:27:10] design at apostolstudio dot com Description: ------------ array('word')==array(0) -- return true Reproduce code: --------------- if(array('word')==array(0)) echo "ERROR"; Actual result: -------------- ERROR ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=44990&edit=1