PHP introduced "===" and "!==" a long time ago, and every programmer should know that they have to use that, without any excuses.
Also, don't use "in_array($a, $b)", but use "in_array($a, $b, true)" instead.
PHP introduced "===" and "!==" a long time ago, and every programmer should know that they have to use that, without any excuses.
Also, don't use "in_array($a, $b)", but use "in_array($a, $b, true)" instead.
Oh yea? How about this,
http://www.reddit.com/r/PHP/comments/2zhg6z/how_true_is_this...
You simply can't use php arrays for user-generated keys in a safe manner. At least you have to add some prefix like '_stuff_' to all keys, to avoid accidental conversions. And yes, this "proper" solution (Can you ever can say "proper" in php? Anyway ...) doesn't have to involve "==", but works perfectly (and preferably) with "===".
In that case, I have a hammer to sell you, and I think you know which one.
Not sure where you read this. I didn't provide any judgement of the situation.
Strawman arguments like this should have no place on HN.