3v4l.org

run code in 300+ PHP versions simultaneously
<?php $xml = <<<'XML' <root xmlns:s="http://some-address.com"> <s:Label x="10" y="10" text="NOME"/> <s:TextInput id="NOME" x="10" y="21" width="290" tabIndex="1"/> <s:Label x="10" y="50" text="TELEFONE"/> <s:Label x="120" y="50" text="RAMAL"/> <s:TextInput id="RAMAL" x="120" y="61" width="102" tabIndex="5"/> <s:Label x="365" y="50" text="LOGIN"/> <s:TextInput id="LOGIN1" x="365" y="61" width="102" tabIndex="7"/> <s:TextInput id="TELEFONE" x="10" y="61" width="102" tabIndex="4"/> <s:Label x="308" y="11" text="EMAIL"/> <s:TextInput id="EMAIL" x="308" y="22" width="290" tabIndex="2"/> <s:Label x="605" y="10" text="MATRICULA"/> <s:TextInput id="MATRICULA" x="606" y="22" width="144" tabIndex="3"/> <s:Label x="627" y="91" text="NASCIMENTO"/> <s:TextInput id="NASCIMENTO" x="627" y="103" width="121" tabIndex="14"/> </root> XML; $simpleXML = new SimpleXMLElement($xml); $xpathTextInput = $simpleXML->xpath('s:TextInput'); foreach($xpathTextInput as $input) { echo $input['id'] . PHP_EOL; }
Output for 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.33, 8.2.0 - 8.2.29, 8.3.0 - 8.3.25, 8.4.1 - 8.4.12
NOME RAMAL LOGIN1 TELEFONE EMAIL MATRICULA NASCIMENTO

preferences:
151.01 ms | 407 KiB | 5 Q