我想替换货币缩写字母表,它目前使用的是M、L等。我想更改为印度货币数字格式,如K、L和CR
以下是代码:
if(!function_exists(\'houzez_number_shorten\')) {
function houzez_number_shorten($number, $precision = 0, $divisors = null) {
$number = houzez_clean_price_20($number);
if (!isset($divisors)) {
$divisors = array(
pow(1000, 0) => \'\', // 1000^0 == 1
pow(1000, 1) => \'K\', // Thousand
pow(1000, 2) => \'M\', // Million
pow(1000, 3) => \'B\', // Billion
pow(1000, 4) => \'T\', // Trillion
pow(1000, 5) => \'Qa\', // Quadrillion
pow(1000, 6) => \'Qi\', // Quintillion
);
}
foreach ($divisors as $divisor => $shorthand) {
if (abs($number) < ($divisor * 1000)) {
// Match found
break;
}
}
//Match found or not found use the last defined value for divisor
$price = number_format($number / $divisor, 1);
$price = str_replace(".0","",$price);
return $price . $shorthand;
}
}
我不擅长编码,因此任何帮助都将不胜感激