$result = number_format($x, 2, '.', ','); //Will do the following correctly
115255 = 115,225.00
115255.4 = 115,225.40
115255.40 = 115,225.40
115255.455 = 115,255.46
But I need when the user enters more than 2 digits after the decimal, not to cut them into 2 decimals only and to use it as it is...
115255.455 = 115,255.455
115255.4557 = 115,255.4557
Can I do something like that?
if($x == number_format($x, 3)) //I will do it in while loop later, lets test 3 now
$result = number_format($x, 3, '.', ',');
else $result = number_format($x, 2, '.', ',');
The previous if condition never works, else only works