Hi all,

I have one small problem I don't understand the preg_replace() method.
 I understand the gist of what it does but I still don't fully know
what it does.  I have read the entry in the php manual about this and
I am still confused about it. I've never been any good with regular
expressions.

Here is the function in use:

function checkPhone ($Phone)
{
        global $errmsg;
                if (!empty($Phone))
                {
                        $Phone = ereg_replace("[^0-9]", '', $Phone);
                        
                        if ((strlen($Phone)) <= 14)
                                return 
preg_replace("/[^0-9]*([0-9]{3})[^0-9]*([0-9]{3})[^0-9]*([0-9]{4}).*/",
"(\\1) \\2-\\3",$Phone);
                }
}

I think my problem is mostly what is returned when preg_replace executes?

Paul

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to