SHARE
TWEET

Untitled

BogdanOvcharov Feb 14th, 2020 53 in 15 days
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. protected function _getNumber($number) {
  2.         if (0 === strpos($number, "+")) {
  3.             $number = preg_replace('/\+/', "00", $number, 1);
  4.         }
  5.  
  6.         $number = preg_replace("/\D/", "", $number);
  7.         if (strlen($number) == 10) {
  8.             $number = "0041".substr($number, 1);
  9.         } else if (strlen($number) == 9) {
  10.             $number = "0041".$number;
  11.         } else if (strlen($number) == 11) {
  12.             $number = "00".$number;
  13.         } else if (strlen($number) < 13 || substr($number,0,2) != "00") {
  14.             throw new Exception("Number not properly formatted");
  15.         }
  16.         return $number;
  17.     }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top