Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / NewStats: 3,195,085 members, 7,957,049 topics. Date: Tuesday, 24 September 2024 at 05:57 AM |
Nairaland Forum / Science/Technology / Programming / Phone Number Validation (3951 Views)
Download All Phone Number Generator, Imei Tweaking And Bb Imei Gen. For Pc / Adding Validation To Javascript Code / [MOD] PHP Workouts-email Validation In Php Using Any Method. (2) (3) (4)
Phone Number Validation by sunej(m): 9:25am On Apr 17, 2011 |
Please I want to validate phone numbers so my script can send sms. The numbers are in local format like 08032537302 but I want to format them to international format 2348032537302. Please help! Am using PHP |
Re: Phone Number Validation by dellnet: 8:44am On Apr 18, 2011 |
|
Re: Phone Number Validation by hustinken: 10:49am On Apr 18, 2011 |
<? //use the below script $mobile_no="08055303653"; //strip out the first 0 and replace it with 234 $new_mobile=substr_replace($mobile_no,'234','0','-10'); echo $new_mobile; //it works ?> |
Re: Phone Number Validation by wavemaster(m): 5:16pm On Apr 19, 2011 |
Or you can try this: <?php $phone= '07062999765'; // Remove initial "0" if the phone number starts with zero if(substr($phone, 0, 1)== 0) { $phone= substr($phone, 1); } // Now you can insert 234 at the beginning if it does not start with 234 if(substr($phone, 0, 3)!= 234) { $phone= '234'.$phone; } // Have a nice day ?> 1 Like |
Re: Phone Number Validation by Nobody: 2:41pm On Apr 21, 2011 |
My Best Advice is to use REGEXP in PHP,its far safer |
(1) (Reply)
New To Python, Gurus Please Help Solve These Challenges. Thanks. / . / Coding Challenge 3: Sum Of Primes
(Go Up)
Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health religion celebs tv-movies music-radio literature webmasters programming techmarket Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10) Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 7 |