/** * Strips the IDD from the start of the number if present. Helper function used by * maybeStripInternationalPrefixAndNormalize. * @param string $iddPattern * @param string $number * @return bool */ private function parsePrefixAsIdd($iddPattern, &$number) { $m = new Matcher($iddPattern, $number); if ($m->lookingAt()) { $matchEnd = $m->end(); // Only strip this if the first digit after the match is not a 0, since country calling codes // cannot begin with 0. $digitMatcher = new Matcher(self::$CAPTURING_DIGIT_PATTERN, substr($number, $matchEnd)); if ($digitMatcher->find()) { $normalizedGroup = $this->normalizeDigitsOnly($digitMatcher->group(1)); if ($normalizedGroup == "0") { return false; } } $number = substr($number, $matchEnd); return true; } return false; }