printf - PHP Fails to Echo or Print Floating Point Variable -
i have issue in php trying display floating point value. however, when try display floating point value via echo or print php fails point on. not getting debugging error messages failure either.
$a=10; $b=3; $c=$a/$b; echo $c; //php fails point on. printf "%f", $c; //php fails too. var_dump($c); //php fails too.
it bothering me such small floating point calculation fails display in screen. however, if commented out lines 3-5. works. suggestion appreciated.
$a=10; $b=3; $c=$a/$b; echo $c; printf("%f", $c); var_dump($c);
you forgot parentheses printf. echo , var_dump should work.
this get: 3.33333333333333.333333float(3.3333333333333)
Comments
Post a Comment