$value = '100.00';
echo $value * 100/100;
Or should I be rounding incase there’s a value such as ‘100.70’? I’m displaying this for a table that displays daily rates, the total value contains the digits so I assume the user won’t have to really worry about decimal values…
Whether or not you should round is up to you. But for this consider using
sprintf().is much better than some arithmetic hack to achieve the same thing. Also, multiplying then dividing by 100 is like multiplying by 1.
Depending on what you want to achieve exactly,
number_format()or evenmoney_format()may be options as well.To do the actual rounding use
round():