WordPress как на ладони
Недорогой хостинг для сайтов на WordPress: wordpress.jino.ru
функция не описана

wc_make_numeric_postcode() WC 2.6.0

Make numeric postcode.

Converts letters to numbers so we can do a simple range check on postcodes. E.g. PE30 becomes 16050300 (P = 16, E = 05, 3 = 03, 0 = 00)

Хуков нет.

Возвращает

Строку.

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

wc_make_numeric_postcode( $postcode );
$postcode(строка) (обязательный)
Regular postcode.

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

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

Код wc make numeric postcode: woocommerce/includes/wc-formatting-functions.php WC 4.3.1

<?php
function wc_make_numeric_postcode( $postcode ) {
	$postcode           = str_replace( array( ' ', '-' ), '', $postcode );
	$postcode_length    = strlen( $postcode );
	$letters_to_numbers = array_merge( array( 0 ), range( 'A', 'Z' ) );
	$letters_to_numbers = array_flip( $letters_to_numbers );
	$numeric_postcode   = '';

	for ( $i = 0; $i < $postcode_length; $i ++ ) {
		if ( is_numeric( $postcode[ $i ] ) ) {
			$numeric_postcode .= str_pad( $postcode[ $i ], 2, '0', STR_PAD_LEFT );
		} elseif ( isset( $letters_to_numbers[ $postcode[ $i ] ] ) ) {
			$numeric_postcode .= str_pad( $letters_to_numbers[ $postcode[ $i ] ], 2, '0', STR_PAD_LEFT );
		} else {
			$numeric_postcode .= '00';
		}
	}

	return $numeric_postcode;
}