无法计算静态数组


Cant count the array in static

我的代码:

const staticList =
        array(
            array('url'=>'http://static0.website.local/', 'token'=>'abc'),
        );
(line:37) const staticNow = staticList[count(staticList)-1];

我得到了错误:

Parse error: syntax error, unexpected '(' in C:'Dropbox'DevCloud'htdocs'website'root'index.php on line 37

更新:我使用的是 PHP 5.6,错误行为 37

无论如何要解决这个问题?谢谢!

量可以用标量值/标量表达式赋值,但不能用动态变量或函数调用赋值。
请考虑以下允许的用法:

const staticList =
        array(
            array('url'=>'http://static0.website.local/', 'token'=>'abc'),
        );
const STATICNOW = staticList[0]["token"];
echo STATICNOW;   // "abc"