Last Updated: February 25, 2016
·
545
· danielerigo

Easy check on PHP input

You can use this native PHP functions to sanitize users input in your code, fast and easy:

Check for alphabetic character(s):
ctype_alpha

Check for numeric character(s):
ctype_digit

Check for alphanumeric character(s):
ctype_alnum

Check for character(s) representing a hexadecimal digit:
ctype_xdigit

Check for uppercase character(s):
ctype_upper

Check for lowercase character(s):
ctype_lower

Check for lowercase character(s) (e.g. line feed, tab, escape.) ("\n\r\t"):
ctype_cntrl

Checks if all of the characters in the provided string creates visible output:
ctype_graph

Check for any printable character which is not whitespace or an alphanumeric character:
ctype_punct

Checks if all of the characters in the provided string creates whitespace:
ctype_space