note: the behavior below is documented in the appendix K about type comparisons, but since it is somewhat buried i thought i should raise it here for people since it threw me for a loop until i figured it out completely.
just to clarify a tricky point about the == comparison operator when dealing with strings and numbers:
('some string' == 0) returns TRUE
however, ('123' == 0) returns FALSE
also note that ((int) 'some string') returns 0
and ((int) '123') returns 123
the behavior makes senes but you must be careful when comparing strings to numbers, e.g. when you're comparing a request variable which you expect to be numeric. its easy to fall into the trap of:
if ($_GET['myvar']==0) dosomething();
as this will dosomething() even when $_GET['myvar'] is 'some string' and clearly not the value 0
i was getting lazy with my types since php vars are so flexible, so be warned to pay attention to the details...