douhu2890 2014-06-27 15:28
浏览 13

too long

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.

  • 写回答

1条回答 默认 最新

  • doushajian2018 2014-06-27 15:36
    关注
    $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)

    评论

报告相同问题?

悬赏问题

  • ¥15 python的qt5界面
  • ¥15 无线电能传输系统MATLAB仿真问题
  • ¥50 如何用脚本实现输入法的热键设置
  • ¥20 我想使用一些网络协议或者部分协议也行,主要想实现类似于traceroute的一定步长内的路由拓扑功能
  • ¥30 深度学习,前后端连接
  • ¥15 孟德尔随机化结果不一致
  • ¥15 apm2.8飞控罗盘bad health,加速度计校准失败
  • ¥15 求解O-S方程的特征值问题给出边界层布拉休斯平行流的中性曲线
  • ¥15 谁有desed数据集呀
  • ¥20 手写数字识别运行c仿真时,程序报错错误代码sim211-100