Jamroom Logo Jamroom 5 Core
is now Open Source!
Follow Jamroom on Twitter!


  Function Index cleanOutput
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"

  • return: returns true/false on success/fail
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"
 Comments
SteveX, 05/21/09 00:18:55:

$input_email_address = "stevex,at,apple.com";

if (checkType($input_email_address,'email')) {

$email_check_result = "Yes, it is an email address";

}

// returns false



$input_email_address = "stevex@apple.com";

if (checkType($input_email_address,'email')) {

$email_check_result = "Yes, it is an email address";

}

// returns true

You must be logged in to post a comment
Solutions Products Support Community Company
Social Media Platform
Social Networking Software
Musician Website Manager
Community Builder
Jamroom 5
Jamroom 5 Modules
Jamroom Marketplace
Support Forum
Documentation
Support Center
Contact Support
Community Forum
Member Sites
Developers
About Us
Contact Us
Privacy Policy
©2003 - 2024 The Jamroom Network