06-07-2008, 05:58 PM
|
#3 (permalink)
|
|
is cute and cuddly
Join Date: Mar 2008
Location: Vegas, Baby
Posts: 963
Thanks: 31
|
There's also the ctype functions to keep in mind for other basic checks. If you wanted a regular expression to do this, it would look something like,
PHP Code:
$szString = "1234567890+-";
if (preg_match("/^[0-9-+]+$/", $szString)) { echo "String '{$szString}' contains only valid characters"; } else { echo "String '{$szString}' contains invalid characters"; }
I was trying to come up with a decent one that didn't use the start of string/end of string qualifiers, just to see if I could, and... nope.
-m
|
|
|
|