Re: checking phone number
| From: | Cynic | Date: | Wed, 20 Dec 2000 20:56:06 +0000 |
| Subject: | Re: checking phone number | ||
| References: | 1 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-4561@lists.php.net to get a copy of this message | ||
$checkphone = preg_replace( '/[^0123456789]/' , '' , $phone )
simpler, better, shorter, faster
At 00:40 21.12. 2000, afan wrote the following:
--------------------------------------------------------------
>Hi all,
>First I want to wish to everybody Happy holydays!
>
>I have to check does submitted phone number already exist in database. I just wrote this:
>$CheckPhone = ereg_replace("\.", "", $Phone);
>$CheckPhone = ereg_replace(" ", "", $CheckPhone);
>$CheckPhone = ereg_replace("\(", "", $CheckPhone);
>$CheckPhone = ereg_replace("\)", "", $CheckPhone);
>$CheckPhone = ereg_replace("\-", "", $CheckPhone);
>$CheckPhone = ereg_replace("\/", "", $CheckPhone);
>
>and it works fine!
>But, probably there is something simpler, better and shorter. Anybody have an idea?
>
>Afan
------end of quote------
____________________________________________________________
Cynic:
A member of a group of ancient Greek philosophers who taught
that virtue constitutes happiness and that self control is
the essential part of virtue.
cynic@mail.cz