wc_format_country_state_string()WC 2.3.0

Formats a string in the format COUNTRY:STATE into an array.

Хуков нет.

Возвращает

Массив.

Использование

wc_format_country_state_string( $country_string );
$country_string(строка) (обязательный)
Country string.

Список изменений

С версии 2.3.0 Введена.

Код wc_format_country_state_string() WC 8.7.0

function wc_format_country_state_string( $country_string ) {
	if ( strstr( $country_string, ':' ) ) {
		list( $country, $state ) = explode( ':', $country_string );
	} else {
		$country = $country_string;
		$state   = '';
	}
	return array(
		'country' => $country,
		'state'   => $state,
	);
}