我有下面的代碼片段:PHP日期時間函數
$now = '2011-12-01 22:32:33';
$datetime = '2011-12-01 00:07:27';
$nowObj = new DateTime($now);
$datetimeObj = new DateTime($datetime);
$diff = $datetimeObj->diff($nowObj); //leaving this in screws up the next line
number_format(1134); //this becomes NaN
當我通過這個代碼運行,並留在$ DIFF = ...線,它與其他的數字和數學,我後來做食堂在代碼中。例如,我的number_format(1134);後來成爲NaN。我正在使用PHP 5.3.1的XAMPP堆棧。這是一個錯誤?
mmm ...你能添加「混亂」代碼嗎? –