math - php multiply int values seperated by comma and dot -


in current application user can have "prepaid" amount of money on account. value stored in cents. in case of user tries transfer money 1 account should able use values like: "1,53", "1.53" , "1". need check if entered amount below amount he's able transfer.

 if (($request->amount * 100) <= $user->calculateamount()) 

the function $user->calculateamount() returns values example "351" stands 3,51€ (saved in cents). know problem ",", using "." works fine, user should able use both. there better way or did need use str_replace()?

you can use this: http://codepad.org/nw4e9hqh

currently there no other method parse float.


Comments

Popular posts from this blog

c - How to retrieve a variable from the Apache configuration inside the module? -

c# - Constructor arguments cannot be passed for interface mocks -

python - malformed header from script index.py Bad header -