note 55583 deleted from function.preg-match by nlopess
| From: | nlopess@php.net | Date: | Mon, 08 Aug 2005 08:17:02 +0000 |
| Subject: | note 55583 deleted from function.preg-match by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-93231@lists.php.net to get a copy of this message | ||
Note Submitter: Teguh Iskanto : kamprettos<at>yahoo
----
A simple example on how to create a string verification function. This might be useful esp for those
who want to check the input from a form
function is_ok_string($buff_string)
{
# your string OK standard
$std_ok_string = "/[^0-9a-z_]/i" ;
# regex
if (!preg_match($std_ok_string, $buff_string))
{
#string is OK
return 1 ;
} else {
#string is *not* OK
return 0 ;
}
}
$string_result = is_ok_string($user_name_input);