using regular expressions and PHP for phone validation function
$10-15 USD
Cancelado
Publicado hace más de 12 años
$10-15 USD
Pagado a la entrega
Hi alexus,
I need the following:
1) Valid_fr_phone ($type) function
User inputs phone number. It maybe a landline or mobile phone number. It may be written with country code (international format) or without (national format.
French phone national number format is Dd dd dd dd dd. First 2 digits are presently: 01 down to 05 for landlines numbers and 06 or 07 for mobile numbers. This is the "national format".
French country code is 33.
The international format is 33(0)d dd dd dd dd. We should accept it, and also 330d dd dd dd dd and 33-0d dd dd dd dd, and other variations (separators)
The tool will validate the phone number and transform it into a string
It will accept any separators, just like a date: space, ",", ";", "-", "/", ".";, both for national and international format.
It will transform the number into international phone number format :33(0)ddddddddd and will insert a prefix "f" for landlines number or "m" for mobile phone numbers.
Finally, get something like m33(0)6dddddddd or f33(0)1dddddddd
$type parameter: can be "f" or "m", or "t". Used to validate only one type of phone number, landline or mobile, or all phone numbers (type "t").
2) .Show_phone(,$phone,$disp, $det) function
- $disp="n" (national), "i" (international)
o "n": dd dd dd dd dd
o "i":33(0)d dd dd dd dd
- $det= "s" (short) or "l" (long): long is phone number ." (fixe)" or phone number ." (mobile)"
- $phone is a string: phone number coded by the valid_number function
## Deliverables
Examples:
$tel =show_phone( "f33(0)123456789","n", "l") ;
Echo $tel will show: 01 23 45 67 89 (mobile)
$tel =show_phone( "f33(0)123456789","i", "l") ;
Echo $tel will show: (33)1 23 45 67 89 (fixe)
$tel =show_phone( "f33(0)123456789","n", "s") ;
Echo $tel will show: 01 23 45 67 89 (mobile)
If you can make the $disp and $det optional (default values national, short), that would be great
Coder should show example of past work using regex.