The following code can be used to convert the number format into indian currency format (Indian rupees, INR) using PHP.
<?php
ob_start();
//Currency format conversion - Indian Rupee
$n = "1000000";
$len = strlen($n); //lenght of the no
$num = substr($n,$len-3,3); //get the last 3 digits
$n = $n/1000; //omit the last 3 digits already stored in $num
while($n > 0) //loop the process - further get digits 2 by 2
{
$len = strlen($n);
$num = substr($n,$len-2,2).",".$num;
$n = round($n/100);
}
echo "Rs.".$num;
?>
Showing posts with label currency. Show all posts
Showing posts with label currency. Show all posts
Friday, May 30, 2008
Subscribe to:
Posts (Atom)