【发布时间】:2015-06-13 09:38:33
【问题描述】:
有这个:
...
private $responseBuffer = array();
...
在这一行内:
$lm = end(array_values($this->responseBuffer));
我明白了
Error: Only variables should be passed by reference (2048)
因为end 和array_values 都是内置的,没有call-by-reference我很困惑,有人知道吗?
(目的:获取$responseBuffer的最新值)
【问题讨论】:
-
你需要一个变量 -
$foo = array_values($this->responseBuffer); $lm = end($foo);,end的第一个参数是 ref -
@Clive 哎呀,我没看到你已经回答了..
-
我没有@xurshid29,把你的留在那里;)
-
这里解释了为什么在传递给
end之前需要将array_values分配给变量 - stackoverflow.com/a/4636183/1426354
标签: php