I have issue where in PHP where I am trying display Floating point value. However, when I try to display this floating point value via echo or print PHP fails from that point on. I am not getting any debugging error messages for the failure either.
$a=10;
$b=3;
$c=$a/$b;
echo $c; //PHP fails from this point on.
printf "%f", $c; //PHP fails for this too.
var_dump($c); //PHP fails for this too.
It is bothering me such a small floating point calculation fails to display in the screen. However, if i commented out lines 3-5. It works. Any suggestion is greatly appreciated.
$a=10;
$b=3;
$c=$a/$b;
echo $c;
printf("%f", $c);
var_dump($c);
You forgot your parentheses for the printf. the echo and var_dump should work.
This is what I get: 3.33333333333333.333333float(3.3333333333333)