framework/i18n/CLocale.php
public function getTerritoryID($id)
	{
		// normalize id
		$id = $this->getCanonicalID($id);
		// find sub tags
		if (($underscorePosition=strpos($id, '_'))!== false)
		{
			$subTag = explode('_', $id);
			// territory sub tags can be distinguished from script sub tags by length
			if (isset($subTag[2]) && strlen($subTag[2])<4)
			{
				$id = $subTag[2];
			}
			elseif (strlen($subTag[1])<4)
			{
				$id = $subTag[1];
			}
			else
			{
				$id = null;
			}
		}
		else
		{
			$id = null;
		}
		return $id;
	}
public function getTerritoryID($id)
	{
		// normalize id
		$id = $this->getCanonicalID($id);
		// find sub tags
		if (($underscorePosition=strpos($id, '_'))!== false)
		{
			$subTag = explode('_', $id);
			// territory sub tags can be distinguished from script sub tags by length
			if (isset($subTag[2]) && strlen($subTag[2])<4)
			{
				$id = $subTag[2];
			}
			elseif (strlen($subTag[1])<4)
			{
				$id = $subTag[1];
			}
			else
			{
				$id = null;
			}
		}
		else
		{
			$id = null;
		}
		return $id;
	}
public function getTerritoryID ( $ id ) { // normalize id $ id = $ this -> getCanonicalID ( $ id ) ; // find sub tags if ( ( $ underscorePosition = strpos ( $ id , '_' ) ) !== false ) { $ subTag = explode ( '_' , $ id ) ; // territory sub tags can be distinguished from script sub tags by length if ( isset ( $ subTag [ 2 ] ) && strlen ( $ subTag [ 2 ] ) < 4 ) { $ id = $ subTag [ 2 ] ; } elseif ( strlen ( $ subTag [ 1 ] ) < 4 ) { $ id = $ subTag [ 1 ] ; } else { $ id = null ; } } else { $ id = null ; } return $ id ; }
Converts a locale ID to a territory ID.
A territory ID consists of only the last two to three letter or digits after an underscore or dash.
@param string $id the locale ID to be converted
@return string the territory ID
@since 1.1.9
Converts a locale ID to a territory ID . A territory ID consists of only the last two to three letter or digits after an underscore or dash .