note 13229 modified in ref.strings.php by zak
| From: | zak@php.net | Date: | Fri, 27 Jul 2001 09:34:28 +0000 |
| Subject: | note 13229 modified in ref.strings.php by zak | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-15934@lists.php.net to get a copy of this message | ||
[Editor's Note:
Or use
$str = preg_replace ('\D+', '', $str);
--zak@php.net]
To strip all non-numeric characters out of a string
(such as a standard US phone number - with no extention), use
$sPhoneNumeric = implode('', preg_split('/\D/', $sPhoneRaw, -1,
PREG_SPLIT_NO_EMPTY));
http://www.php.net/manual/en/ref.strings.php.php