note 101133 added to function.strspn
| From: | (at_he.hotmail) | Date: | Sun, 28 Nov 2010 22:45:00 +0000 |
| Subject: | note 101133 added to function.strspn | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-174424@lists.php.net to get a copy of this message | ||
you can use this function with strlen to check illegal characters, string lenght must be the same
than strspn (characters from my string contained in another)
<?php
$digits='0123456789';
if (strlen($phone) != strspn($phone,$digits))
echo "illegal characters";
?>
----
Server IP: 190.54.16.132
Probable Submitter: 201.246.90.187
----
Manual Page -- http://www.php.net/manual/en/function.strspn.php
Edit -- https://master.php.net/note/edit/101133
Del: integrated -- https://master.php.net/note/delete/101133/integrated
Del: useless -- https://master.php.net/note/delete/101133/useless
Del: bad code -- https://master.php.net/note/delete/101133/bad+code
Del: spam -- https://master.php.net/note/delete/101133/spam
Del: non-english -- https://master.php.net/note/delete/101133/non-english
Del: in docs -- https://master.php.net/note/delete/101133/in+docs
Del: other reasons-- https://master.php.net/note/delete/101133
Reject -- https://master.php.net/note/reject/101133
Search -- https://master.php.net/manage/user-notes.php