I\'m encountering something weird and I don\'t know why it is happening!
I have a URL like:
http://mysite.com/users/USER_ID
this user id
From http://php.net/manual/en/language.operators.comparison.php
Example Name Result
$a == $b Equal TRUE if $a is equal to $b after type juggling.
$a === $b Identical TRUE if $a is equal to $b,
and they are of the same type.
Your string is casted to integer because of type juggling on == operator and intval() of a string returns 0
This explains why $id == $id_inted in your code evaluates to true.
If you make your test with === instead of == no type juggling will be performed.