Consider the below code
$t = preg_replace('/0+$/','',".800000000000000"); //Replace last 0s
This gives me output as .8 as expected
Now consider the below code
$a = .80;
$t = sprintf('%.15f', $a)."<br>";
echo "First : $t<br>";
$t = preg_replace('/0+$/','',$t);
echo "Second : $t <br>";
This gives output as First : 0.800000000000000 Second : 0.800000000000000
Could you help me to find out why the last 0s are not replaced by regular expression in this case as the expected output is 0.8 ?