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.
Return Return
(array)
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,
);
}
Changelog Changelog
| Version | Description |
|---|---|
| 2.3.0 | Introduced. |