Re: note 89998 added to function.preg-match-all
| From: | Daniel Brown | Date: | Wed, 01 Apr 2009 13:15:24 +0000 |
| Subject: | Re: note 89998 added to function.preg-match-all | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-152698@lists.php.net to get a copy of this message | ||
Re-inserted.
On Wed, Apr 1, 2009 at 06:09, ad <admin.djokodonev.com@osu1.php.net> wrote:
> i have made up a simple function to extract a number from a string..
>
> I am not sure how good it is, but it works.
>
> It gets only the numbers 0-9, the "-", " ", "(", ")",
> "."
>
> characters.. This is as far as I know the most widely used characters for a Phone number.
>
> function clean_phone_number($phone) {
> if (!empty($phone)) {
> //var_dump($phone);
> preg_match_all('/[0-9\(\)+.\- ]/s', $phone, $cleaned);
> foreach($cleaned[0] as $k=>$v) {
> $ready .= $v;
> }
> var_dump($ready);
> die;
> if (mb_strlen($cleaned) > 4 && mb_strlen($cleaned) <=25) {
> return $cleaned;
> }
> else {
> return false;
> }
> }
> return false;
> }
> ----
> Server IP: 89.190.194.18
> Probable Submitter: 87.121.44.186
> ----
> Manual Page --
> http://www.php.net/manual/en/function.preg-match-all.php
> Edit -- https://master.php.net/note/edit/89998
> Del: integrated --
> https://master.php.net/note/delete/89998/integrated
> Del: useless --
> https://master.php.net/note/delete/89998/useless
> Del: bad code --
> https://master.php.net/note/delete/89998/bad+code
> Del: spam --
> https://master.php.net/note/delete/89998/spam
> Del: non-english --
> https://master.php.net/note/delete/89998/non-english
> Del: in docs --
> https://master.php.net/note/delete/89998/in+docs
> Del: other reasons-- https://master.php.net/note/delete/89998
> Reject -- https://master.php.net/note/reject/89998
> Search -- https://master.php.net/manage/user-notes.php
>
>
> --
> PHP Notes Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--
</Daniel P. Brown>
daniel.brown@parasane.net || danbrown@php.net
http://www.parasane.net/ || http://www.pilotpig.net/
50% Off All Shared Hosting Plans at PilotPig: Use Coupon DOW10000