تابع ووکامرسی wc_let_to_num تبدیل حرف لفظی به عدد

تابع ووکامرسی wc_let_to_num – تبدیل حرف لفظی به عدد
Syntax – سینتکس
(int) wc_let_to_num( $size );
Parameters – پارامتر ها (1)
- 1- $size
Usage – نحوه استفاده
if ( !function_exists( 'wc_let_to_num' ) ) {
require_once ABSPATH . PLUGINDIR . 'woocommerce/includes/wc-formatting-functions.php';
}
// The size.
$size = null;
// NOTICE! Understand what this does before running.
$result = wc_let_to_num($size);
Defined – محل تعریف
/includes/wc-formatting-functions.php
function wc_let_to_num( $size ) {
$l = substr( $size, -1 );
$ret = substr( $size, 0, -1 );
switch ( strtoupper( $l ) ) {
case 'P':
$ret *= 1024;
case 'T':
$ret *= 1024;
case 'G':
$ret *= 1024;
case 'M':
$ret *= 1024;
case 'K':
$ret *= 1024;
}
return $ret;
}
versions – نسخه ها
از نسخه : 3.0.2
نسخه فعلی : 3.0.6
دیگر نسخه ها : 3.0.6 , 3.0.5 , 3.0.4 , 3.0.3 , 3.0.2
ارسال نظر