Php – Small Fix

Php – Small Fix

Hello,

I have some php website, it is all working fine. On the website are 3 different forms, where the user can input his Phone number. As you all know every country uses a different format locally. For example in some countries people dial : 03847232 while in another country they always dial like: 0049 and so on.

We already have a check in there, which will adjust the number if the user has entered a wrong prefix/format. For example if he enters: 0402237174134 it would be changed automatically to : 0049402237174134 (0049 is german country code.)

see this code snippet 🙂

$CountryCode = substr($num, 0 , (strlen($num) – 11) ) ;
if (strlen($num) > 10 ) {
else {
$CountryCode = “0049” ;
}

if (isset ($_REQUEST[‘show_my_phone’])) {
$Co = $num ;
if (preg_match (“/^(0049)/”, $num) ){
$Co = str_replace(“0049”, “0”, $num) ;
}

There need to be a few variations added, so no possiblity is left and in whatever format the user will enter the number it will be changed accordingly. But as the checks are already there it should be very easy for someone with PHP Knowledge. Realistic, It should not take you longer than 1 hour.. If you think it will take longer, please do not bid.

Thanks.

Leave a Reply

Your email address will not be published. Required fields are marked *