3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $xml = <<<XML <?xml version="1.0"?> <Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet" xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet"> <Table Foo="Bar" ss:ExpandedColumnCount="7"> </Table> </Workbook> XML; $sxml = new SimpleXMLElement($xml); /** * Access attribute of default namespace */ var_dump((string) $sxml->Table[0]['Foo']); // outputs: 'Bar' /** * Access attribute of non-default namespace */ var_dump((int) $sxml->Table[0]['ExpandedColumnCount']); // outputs: 0 var_dump((int) $sxml->Table[0]->attributes('ss', TRUE)->ExpandedColumnCount); // outputs: '7' ?>
Output for 5.4.0 - 5.5.0
Parse error: syntax error, unexpected end of file in /in/deFEW on line 27
Process exited with code 255.
Output for 5.3.0 - 5.3.27
Parse error: syntax error, unexpected $end in /in/deFEW on line 27
Process exited with code 255.