How to set Money Format in PHP -
i making real estate portal.in user has entered property value 55,00,000 - 45,35,000 - 30,00,000 , on. question ,i want show values 55 lac(s) - 45.35 lac(s) - 30 lac(s) on.so please..suggest me, how can make possible.
thanks
for normal cases money_format ideal way go, require use 'lac' format. need write own code on conditions basis.
first remove commas user entered amount. that
$number = str_replace(',', '', $number); then check , make required string.
if($number > 10000000) { $num = ((float)$number) / 10000000; $num = $num.' crore(s)' } else if($number > 100000) { $num = ((float)$number) / 100000; $num = $num.' lac(s)' } else if($number > 1000) { $num = ((float)$number) / 1000; $num = $num.' thousand(s)' }
Comments
Post a Comment