Reply to comment

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.

Reply

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <blockquote>
  • Lines and paragraphs break automatically.
  • You may post code using <code>...</code> (generic) or <?php ... ?> (highlighted PHP) tags.

More information about formatting options