تابع ووکامرسی wc_normalize_postcode نرمال سازی کد پستی

تابع ووکامرسی wc_normalize_postcode نرمال سازی کد پستی

تابع ووکامرسی wc_normalize_postcode – نرمال سازی کد پستی

Syntax – سینتکس

(string) wc_normalize_postcode( (string) $postcode ); 

Parameters – پارامتر ها (1)

  • 1- $postcode (string)

Returns – مقادیر بازگشتی (string)

Sanitized postcode.

Usage – نحوه استفاده

if ( !function_exists( 'wc_normalize_postcode' ) ) { 
    require_once ABSPATH . PLUGINDIR . 'woocommerce/includes/wc-formatting-functions.php'; 
} 
  
// The postcode. 
$postcode = ''; 
  
// NOTICE! Understand what this does before running. 
$result = wc_normalize_postcode($postcode); 
    

Defined – محل تعریف

/includes/wc-formatting-functions.php

function wc_normalize_postcode( $postcode ) { 
    $postcode = function_exists( 'mb_strtoupper' ) ? mb_strtoupper( $postcode ) : strtoupper( $postcode ); 
    return preg_replace( '/[\s\-]/', '', trim( $postcode ) ); 
} 

versions – نسخه ها

از نسخه : 2.6.0

نسخه فعلی : 3.0.6

دیگر نسخه ها : 3.0.6 , 3.0.5 , 3.0.4 , 3.0.3 , 3.0.2

ارسال نظر

جهت استفاده از کد حتما از تگ pre استفاده نمایید .

contact us