Posts Tagged ‘PHP’

Tip of the day: Loose comparisons in PHP gives edgy behaviour

Posted on May 27, 2009, 10:23, in Tip of the day, Web development | No Comments

This is an occasionally recurring issue: Using loose comparison (i.e. “==”, “!=”), instead of strict (i.e. “===”, “!==”), in PHP can give some unexpected results. Some of those are pretty logical – like an empty array compared to 0 or false, returns true – but others not quite that logical. Example // returns true “string” […]