PHP 为什么不能将静态变量初始化为time()?

PHP Why can't initialize static variable to time()?

我在将静态变量初始值设置为 time() 时收到错误消息。

错误信息是"语法错误,意外的'(',期待','或';'在[...][.. .] 第 7 行"

<?php 
define("DEBUG", true);
define("NEWLINE", "<br>");
...
function debugMsg($msg) {
    static $lastTime = time();
    if(DEBUG==true) echo date('Y-m-d H:i:s', time())." ".$msg." (".(time()-$lastTime)." seconds)".NEWLINE;
    $lastTime = time();
}
?>

debugMsg("XXX task completed");
//My expected output like below:
//2015-05-01 15:04:47 XXX task completed (2 seconds) 

来自 PHP 文档 link

Static variables may be declared as seen in the examples above. Trying to assign values to these variables which are the result of expressions will cause a parse error.

您正在尝试为作为表达式结果的变量赋值