Need to replace Currency Shortforms

Question

I want to replace the currency shorten alphabet, it is currently in M, L and So on.
I want to change to indian currency number format like K, L and CR

below is code:

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;
}

I am not good at coding, so any help will be appreciated

0
Vijay Patil 2 years 2020-12-25T10:10:24-05:00 0 Answers 6 views 0

Leave an answer

Browse
Browse