I have a code in which calculates the Effective interest rate. when I echo it I get 5.1161897881733 which I want to limit the remainder and output it like 5.11, is there any functions use to limit the remainder in php?
A billion ways to do this. The task for you here is to pick one.
This will just round your number. The exact rules can be found in the PHP.net documentation.
round($someNumber, 2);
Floor will round the number down
floor($someNumber, 2);
Opposite to floor() this will round your number upwards.
ceil($someNumber, 2);
This will format any number. number_format()
has a gazillion possible inputs in which you can choose decimal characters etc.
// Will round your number to 2 decimals with a . as decimal character
number_format($someNumber, 2, ",", ".");
Feel free to edit and add more options :)