If you have them as numbers, you can use this function directly.
function formatValue($size, $precision = 1)
{
static $suffixes = array('', 'k', 'm');
$base = log($size) / log(1000);
return round(pow(1000, $base - floor($base)), $precision) . $suffixes[floor($base)];
}
If you don't have them as numbers, use PHP: unformat money
For you particular case you may use little dirty hack, but I don't recommend it if you have more special cases.
function formatValue($size, $precision = 1)
{
static $suffixes = array('', 'k', 'm');
$base = log($size) / log(1000);
if ($base >= 5/3 && $base < 2) {
return round(pow(1000, $base - floor($base)) / 100, $precision) . 'lakh';
}
return round(pow(1000, $base - floor($base)), $precision) . $suffixes[floor($base)];
}