wc_format_country_state_string( string $country_string )

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


Description Description


Parameters Parameters

$country_string

(Required) Country string.


Top ↑

Return Return

(array)


Top ↑

Source Source

File: includes/wc-core-functions.php

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,
	);
}

Top ↑

Changelog Changelog

Changelog
Version Description
2.3.0 Introduced.


Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.