WC_Validation::format_postcode PHP Method

format_postcode() public static method

Format the postcode according to the country and length of the postcode.
public static format_postcode ( $postcode, $country ) : string
return string formatted postcode
    public static function format_postcode($postcode, $country)
    {
        return wc_format_postcode($postcode, $country);
    }

Usage Example

Esempio n. 1
0
 /**
  * Data provider for test_format_postcode.
  *
  * @since 2.4
  */
 public function data_provider_test_format_postcode()
 {
     return array(array('99999', WC_Validation::format_postcode('99999', 'IT')), array('99999', WC_Validation::format_postcode(' 99999 ', 'IT')), array('99999', WC_Validation::format_postcode('999 99', 'IT')), array('ABCDE', WC_Validation::format_postcode('abcde', 'IT')), array('AB CDE', WC_Validation::format_postcode('abcde', 'GB')), array('AB CDE', WC_Validation::format_postcode('abcde', 'CA')));
 }