checkType
The checkType function will test a value to see if it is the specified "type" (i.e. number, float, email, etc.) and return true if the input value matches the type.
Acceptable values for "type" are: - alphanumeric - alphanumeric characters only
- alphanumeric_ws - alphanumeric characters + spaces
- alpha - alpha characters only (no numbers)
- alpha_under - alpha characters only, including underscores
- alpha_ws - alpha characters only + spaces
- checkbox - checks for "on" or "off"
- comma_list - checks for a list of elements separated by commas
- date - checks to ensure value is a date
- directory - tests that the value is a directory on the local server
- email - ensures the value is a valid email address
- file - ensures the value is a file
- float - checks that the value is a floating point number
- hex - checks if the value is a hexidecimal value
- ip_address - checks the value to ensure it is a valid IP Address
- is_captcha - checks the value to see if it is a valid CAPTCHA code for the current session
- md5 - checks the value to ensure it is a 32 character long MD5 hash
- number_list - checks the value to ensure it is a set of numbers separated by commas
- number_nz - ensures the value is a positive integer
- number_nn - ensures the value is a number greater than or equal to zero
- onoff - ensures the value is either "on" or "off"
- price - ensures the value is a valid price
- sha1 - checks that the value is a SHA1 hash (40 characters)
- url - checks the value to be sure it is a valid URL
- yesno - checks the value to ensure it is either "yes" or "no"
bool
checkType
(string $input, [string $type = false], [array $args = false])
-
string
$input: String to test
-
string
$type: "Type" to test incoming string against.
-
array
$args: Additional arguments for checktype "type"
|