PHP XMLReader - 访问ELEMENT常量但得到T_PAAMAYIM_NEKUDOTAYIM错误[关闭]

Got a server running: php 5.2.17, libxml 2.7.8 with XMLReader enabled.

The problem is, it's complaining about parse error with T_PAAMAYIM_NEKUDOTAYIM when I try $xmlReader::ELEMENT.

Is there any specific version that this behavior was introduced? as it seems to work fine on my offline 5.3.6 server...

    $xmlReader = new XMLReader;
    if (!$xmlReader->open('file.xml', null, 1<<19)){
        throw new Exception('Unable to read file',1);
    }

    # Go down to WEBRESOURCES node level
    while ($xmlReader::ELEMENT){ // This is what it throws the parse error for
        if ($xmlReader->name == "blahblah"){
            break;
        }
        $xmlReader->read();
    }

Thanks, Dom

Use the name of the class instead of the instance. XMLReader::ELEMENT

I think your while-loop should look like

while ($xmlReader->nodeType == XMLReader::ELEMENT) { 
    if ($xmlReader->name == "blahblah"){
        break;
    }
    $xmlReader->read();
}