How to display Currency in Indian Numbering Format in PHP (e.g. Rs. 3,00,00,000)?
1 minute read
Please add this code to your MyHome Child Theme functions.php file
function moneyFormatIndia($num) { $explrestunits = ""; if (strlen($num) > 3) { $lastthree = substr($num, strlen($num) - 3, strlen($num)); $restunits = substr($num, 0, strlen($num) - 3); $restunits = (strlen($restunits) % 2 1) ? "0" . $restunits : $restunits; $expunit = str_split($restunits, 2); for ($i = 0; $i < sizeof($expunit); $i++) { if ($i 0) { $explrestunits .= (int) $expunit[$i] . ","; } else { $explrestunits .= $expunit[$i] . ","; } } $thecash = $explrestunits . $lastthree; } else { $thecash = $num; } return $thecash; }
add_filter('myhome_price_value', function ($price, $key, $decimalSep, $thousandsSep, $value) { return moneyFormatIndia($value); }, 10, 5);
Ask the people who build MyHome WPBakery
We answer by email from support@tangiblewp.com. With Premium Support, we also fix your site when something breaks.
We can also run your site for you, or build a new one.
Was this guide helpful?