note 36987 deleted from function.is-string by didou
| From: | didou@php.net | Date: | Wed, 29 Oct 2003 21:33:55 +0000 |
| Subject: | note 36987 deleted from function.is-string by didou | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-59500@lists.php.net to get a copy of this message | ||
Note Submitter: mstjacques@sympatico.ca
----
mwwaygoo's comment is wrong. ereg will only test the presence of alpha in the submitted
string, not validate a single character.
The same goes to janfolkert. Words like "apple" or "Aardwark" will also flag
true because "apple" is really greater than "a".
-----
Really want to test a single character ? use preg_match(). According to PHP docs, it's
allegedly faster than ereg:
if (!preg_match("/^[a-zA-Z]$/",$character))
return false;