PHP变量没有增加

时间:2011-03-20 01:06:12

标签: php

我有一个小代码作为大文件的一部分,如下所示:

if(($lastLogTime + $logOffset)>= $text1)
{
    echo $text1.'<br>';

    $uptime=$uptime + (($text1 - $lastLogTime)/60000);
    echo ($text1 - $lastLogTime).'<br>';
    fwrite($fd, $uptime.',');
    echo $uptime.'<br><br>';

    $lastLogTime = ($lastLogTime + 1800000);
    echo $lastLogTime.' ME <br>';
}

奇怪的部分是最终$lastLogTime的输出不会被1800000或之前初始化的名为$logInterval = 1800000的变量添加。

输出

1298083876650     -  i.e lastLogtime
1298083877661     - text1

1011              - the difference
0.01685           - uptime

1298085676650 ME  - damn ! doesn't get added by 1800000

新编辑:

我解决了!不好的答案家伙..不管怎样,谢谢你。

我是唯一一个面对奇怪的人吗?

1 个答案:

答案 0 :(得分:0)

我怀疑它与此有关: What's the maximum size for an int in PHP?

查看php日期功能。虽然使用日期可能很繁琐,但通常将所有内容转换为秒都不是最佳方法。

http://php.net/manual/en/function.date.php