As noted above unfortunately many PHP developers are seemingly unaware of these functions and are still using less efficient equivalents.
Use the ctype functions for input type vaildation.
Example wrapper function:
function detect_type($str, $type_req = ''){
$type = array();
(ctype_alnum($str) === TRUE) ? ($type = 'alnum') : FALSE;
(ctype_digit($str) === TRUE) ? ($type = 'digit') : FALSE;
(ctype_alpha($str) === TRUE) ? ($type = 'alpha') : FALSE;
return ($type === $type_req) ? TRUE : FALSE;
} // end fun
$str = 'AlphaString';
$type_req = 'alpha';
// Returns TRUE if the string is of the required type
echo detect_type($str, $type_req);