var_dump(Map::map);
在PHP 5.5.9这给了我 解析错误:语法错误,意想不到的,希望 ']' 在map.php ''上线14(即在下面的数组声明第一个串联标记)
在PHP 5.6它转储没有任何警告或通知该阵列。
class Map
{
const map = [
'admin' => [
'' => __DIR__ . 'somefile.php'],
'resa' => __DIR__ . 'somefile.php',
'galleri' => __DIR__ . 'somefile.php',
'kategori' => __DIR__ . 'somefile.php',
'' => [
'' => __DIR__ . 'somefile.php',
'katalog' => __DIR__ . 'somefile.php',
'resan' => __DIR__ . 'somefile.php',
'bussresor' => __DIR__ . 'somefile.php',
'kontakt' => __DIR__ . 'somefile.php'],
'ajax' => __DIR__ . 'somefile.php',
'test' => [
'' => __DIR__ . 'somefile.php',
'test1sub' => __DIR__ . 'somefile.php',
'test2' => [
'' => __DIR__ . 'somefile.php',
'test2sub' => __DIR__ . 'somefile.php',
'test3' => [
'' => __DIR__ . 'somefile.php',
'test3sub' => __DIR__ . 'somefile.php'
]
]
]
];
}
http://php.net/manual/en/migration56.new-features.php#migration56.new-features.const-scalar-exprs –