wc_format_country_state_string()
Formats a string in the format COUNTRY:STATE into an array.
No Hooks.
Returns
Array.
Usage
wc_format_country_state_string( $country_string );
- $country_string(string) (required)
- Country string.
Changelog
| Since 2.3.0 | Introduced. |
wc_format_country_state_string() wc format country state string code WC 10.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,
);
}