Add prefix to mobile number in php before sending it to database [duplicate]

Have you tried using regular expressions?

 //check the first section is singular or multi, check area code between 0 and 9, check any additional integers
 $pattern = "[0|00]+[0-9]+[^\\s]";
 $phone_number = "000263712702879"; //international phone number
 if(preg_match($pattern, $phone_number)) {
      echo "this is a number";
 } else echo "this not a number";

Leave a Comment