WordPress at Your Fingertips
function is not described

wc_get_wildcard_postcodes() WC 2.6.0

Return a list of potential postcodes for wildcard searching.

No Hooks.

Return

String[].

Usage

wc_get_wildcard_postcodes( $postcode, $country );
$postcode(string) (required)
Postcode.
$country(string)
Country to format postcode for matching.
Default: ''

Changelog

Since 2.6.0 Introduced.

Code of wc_get_wildcard_postcodes() WC 5.6.0

function wc_get_wildcard_postcodes( $postcode, $country = '' ) {
	$formatted_postcode = wc_format_postcode( $postcode, $country );
	$length             = function_exists( 'mb_strlen' ) ? mb_strlen( $formatted_postcode ) : strlen( $formatted_postcode );
	$postcodes          = array(
		$postcode,
		$formatted_postcode,
		$formatted_postcode . '*',
	);

	for ( $i = 0; $i < $length; $i ++ ) {
		$postcodes[] = ( function_exists( 'mb_substr' ) ? mb_substr( $formatted_postcode, 0, ( $i + 1 ) * -1 ) : substr( $formatted_postcode, 0, ( $i + 1 ) * -1 ) ) . '*';
	}

	return $postcodes;
}