PHP has pretty flexible types. This is (usually) a good thing. It also has some rather handy functions to force types. Arguably the most useful of these is intval. When it comes to working with AJAX (in particular), or user generated input (in general), these functions are a godsend. The only one that seems to mysteriously be missing, though, is 'boolval'.