Formatting Phone Numbers with country code in PHP -
i working on website client submit phone number , need able convert customer's phone number 0553322111 966553322111 can utilize compare records in mysql database.
how go php?
when user submit phone number in html page
he submitted 0553322111.
in php
<?php // store submitted num. $temp = $_post['number']; >> 0553322111. ?>
what want ,,
i want utilize $temp value stores number , modify 966553322111
so can query records new value
i wish clear you.
use preg_replace:
$phone_number = preg_replace('/^0/','966',$phone_number); /^0/ = 0 @ start of string
so says, replace 0 @ start of string 966
let me know if works.
php phone-number
No comments:
Post a Comment