Submitted by Anonymous (not verified) on Wed, 05/19/2010 - 00:10.
Well use === when the type of the variables to compare is relevant ... and for in_array use the 3rd and last argument "strict" which allows to take care of the types of the value you are searching.
I don't think we can call this a real WTF, as the way PHP is permissive with variable types cannot be possible without some elementary rules of types interpretation, in general it allows code to be shorter, but it's sure that with inexperienced coders this can lead to this kind of confusion.
Well use === when the type of
Well use === when the type of the variables to compare is relevant ... and for in_array use the 3rd and last argument "strict" which allows to take care of the types of the value you are searching.
I don't think we can call this a real WTF, as the way PHP is permissive with variable types cannot be possible without some elementary rules of types interpretation, in general it allows code to be shorter, but it's sure that with inexperienced coders this can lead to this kind of confusion.