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++ - llvm function pass ReplaceInstWithInst malloc -

Cross-Compiling Linux Kernel for Raspberry Pi - ${CCPREFIX}gcc -v does not work -

java.lang.NoClassDefFoundError When Creating New Android Project -