note 36987 added to function.is-string
| From: | mstjacques at sympatico dot ca | Date: | Wed, 29 Oct 2003 19:38:36 +0000 |
| Subject: | note 36987 added to function.is-string | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-59493@lists.php.net to get a copy of this message | ||
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;
----
Manual Page -- http://www.php.net/manual/en/function.is-string.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+36987
Delete -- http://master.php.net/manage/user-notes.php?action=delete+36987&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+36987&report=yes
Search -- http://master.php.net/manage/user-notes.php