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

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

android - Keyboard hides my half of edit-text and button below it even in scroll view -