Q:

Why is 'bob@example.com' in array(0,1,2,3,4)?

Why is it that 'bob@example.com' is considered to be in_array array(0,1,2,3,4)?
$email = 'bob@example.com';
$validValues = array(0,1,2,4);
var_dump(in_array($email, $validValues));       // bool(true)
var_dump(in_array($email, $validValues, true)); // bool(false)

So what is going on here? 

A:

Because 0 == 'bob@example.com' (the string is converted to a number), but 0 !== 'bob@example.com'.
The == and != operators perform type coercion, and will convert one operand to match the type of the other.  The === and !== operators will return false if the types of the operands are not exactly the same and the value of the operands are equal.
The third argument to in_array() determines which type of equality test is used.

