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

Popular posts from this blog

user interface - How to replace the Python logo in a Tkinter-based Python GUI app? -

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -