Comparing strings and integers
Originally posted at saji-codes tumblr.
did you know?
When comparing int to string in php, string gets casted to integer, not the other way around.
<?php
var_dump(42 == 'foo'); // false, (int)'foo' === 0
var_dump(42 == 'foo42'); // false, (int)'foo42' === 0
var_dump(42 == '42foo'); // true, (int)'42foo' === 42
encoutered by bartek.m