【发布时间】:2017-04-04 13:43:42
【问题描述】:
我有问题。我用 echo 函数打印一个值不会打印结果,而是用 var_dump 返回值。
//$issue['fields']['timeestimate'] value is 2700
echo $this->toHours($issue['fields']['timeestimate']); return nothing
var_dump($this->toHours($issue['fields']['timeestimate'])); return float(0.75)
功能是
private function toHours($seconds){
return $seconds/3600;
}
怎么了?如果值为 1 或更高,则返回正确的值。
【问题讨论】:
-
试试php.net/manual/en/function.ceil.php 我想这就是你所追求的......
-
很可能是精度问题。阅读大红框php.net/manual/en/language.types.float.php
-
不起作用。 echo 函数继续不返回任何内容。
-
这里的代码没问题,bug肯定在别的地方。编码?
timeestimate中的空格或特殊字符。请显示所有var_dump($issue['fields']['timeestimate'])var_dump($seconds/3600)var_dump($this->toHours($issue['fields']['timeestimate']));真实(复制和粘贴)
标签: php