I'm trying to find a fast way to first make my number 2 decimals only and then remove zero decimals from result values like this:
echo function(0.00);
// 0
echo function(125.70);
// 125.7
echo function(245.051);
// 245.05
echo function(2245.0090);
// 2245.01
I tried number format but when I call it with 0 it acts like this:
echo number_format(0,2)
// 0.00
But I want 0
Does there exist some optimized way to do that?