php - Convert posted value to decimal with number_format -
i have number 10,000 in post data, , want store in db 10000.00
i have following: (in kohana)
number_format(input::post('amount'),2,'.',''); but gives me error:
errorexception [ notice ]: non formed numeric value encountered since $_post['amount'] = 10,000
any suggestions how can solve this?
the comma causing problem, strip out using str_replace
number_format(str_replace(',', '', input::post('amount')), 2, '.', '');
Comments
Post a Comment