多维数组上未初始化的字符串偏移量

时间:2012-01-20 00:03:06

标签: php arrays multidimensional-array initialization

知道为什么第2行和第6行会抛出Notice: Uninitialized string offset: 0

function get_user_class() {
    if ((int) $GLOBALS['CURUSER']['class'] > $GLOBALS['UC_HIGHEST_CLASS'] || (int) $GLOBALS['CURUSER']['class'] < 0) {
        exit();
    }
    else
        return $GLOBALS['CURUSER']['class'];
}

var_dump($GLOBALS['CURUSER']['class'])

给出:

string '0' (length=1)

php -v

是:

PHP 5.2.6-1+lenny13 with Suhosin-Patch 0.9.6.2

0 个答案:

没有答案