In my current application a user can have a "prepaid" amount of money on his account. The value is stored in cents. Now in case of a user tries to transfer money from one account to another he should be able to use values like: "1,53", "1.53" and "1". Now I need to check if the entered amount is below the amount he's able to transfer.
if (($request->amount * 100) <= $user->calculateAmount())
The function $user->calculateAmount() returns values like for example "351" which stands for 3,51€ (saved in cents). I know the problem is the ",", using a "." works fine, but user should be able to use both. Is there a better way or did I need to use str_replace()?