libphonenumber\PhoneNumberUtil::isNANPACountry PHP Method

isNANPACountry() public method

Checks if this is a region under the North American Numbering Plan Administration (NANPA).
public isNANPACountry ( string $regionCode ) : boolean
$regionCode string
return boolean true if regionCode is one of the regions under NANPA
    public function isNANPACountry($regionCode)
    {
        return in_array($regionCode, $this->nanpaRegions);
    }

Usage Example

 public function testIsNANPACountry()
 {
     $this->assertTrue($this->phoneUtil->isNANPACountry(RegionCode::US));
     $this->assertTrue($this->phoneUtil->isNANPACountry(RegionCode::BS));
     $this->assertFalse($this->phoneUtil->isNANPACountry(RegionCode::DE));
     $this->assertFalse($this->phoneUtil->isNANPACountry(RegionCode::ZZ));
     $this->assertFalse($this->phoneUtil->isNANPACountry(RegionCode::UN001));
     $this->assertFalse($this->phoneUtil->isNANPACountry(null));
 }
PhoneNumberUtil