On Fri, 2003-10-10 at 16:18, Curt Zirzow wrote:
> On Fri, 10 Oct 2003 14:01:00 -0400 (EDT), Lists <[EMAIL PROTECTED]> wrote:
> 
> > I do not know if this is the right list, but if someone could help me 
> > with the following
> 
> Sure, I'll be glad to help.
> 
> 
> > I need a function that does this:
> 
> I'm not sure if you want me to write the code that does this for you, but I 
> know that I wont. I'm just going to give you the tools that are commonly
> used for the tasks your asking for.
> 
> >
> > function phone($num) {
> >
> > take num and remove anything that is not a number
> > ex: () - /
> 
> http://php.net/preg_replace
> 
> >
> >
> > If there is not 1 at the start, add a one to the start of the number.
> 
> http://php.net/substr
> 
> >
> > make sure that the number is 10 digits (if not return -1)
> 
> http://php.net/strlen
> 
> > }
> >
> > Thank you for your help,
> 
> In the future, please at least try and attempt to write the code, most 
> people here arnt here to write code for everyone, but to solve problems 
> people are
> having with their own code.

Incidentally the procedure for correcting the number is flawed. If you
(original poster) have a 9 digit number with an area code beginning with
a 1 then the required additional 1 will never be prepended. Really what
you want is if the sequence of numbers is 9 digits long then precede
with a 1.

Cheers,
Rob.
-- 
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com |
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for       |
| creating re-usable components quickly and easily.          |
`------------------------------------------------------------'

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

Reply via email to