3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $str=<<<XML <scales> <co val="East"> <di val="Atlantic"> <t tid="1610612738" ta="BOS" tn="Celtics" tc="Boston" see="" cli="0" elim="0" str="" l10="0-0" dr="0-0" cr="0-0" l="0" w="0" hr="0-0" ar="0-0" gb=""/> <t tid="1610612751" ta="BKN" tn="Nets" tc="Brooklyn" see="" cli="0" elim="0" str="" l10="0-0" dr="0-0" cr="0-0" l="0" w="0" hr="0-0" ar="0-0" gb=""/> <t tid="1610612752" ta="NYK" tn="Knicks" tc="New York" see="" cli="0" elim="0" str="" l10="0-0" dr="0-0" cr="0-0" l="0" w="0" hr="0-0" ar="0-0" gb=""/> <t tid="1610612755" ta="PHI" tn="76ers" tc="Philadelphia" see="" cli="0" elim="0" str="" l10="0-0" dr="0-0" cr="0-0" l="0" w="0" hr="0-0" ar="0-0" gb=""/> <t tid="1610612761" ta="TOR" tn="Raptors" tc="Toronto" see="" cli="0" elim="0" str="" l10="0-0" dr="0-0" cr="0-0" l="0" w="0" hr="0-0" ar="0-0" gb=""/> </di> <di val="Central"> <t tid="1610612739" ta="CLE" tn="Cavaliers" tc="Cleveland" see="" cli="0" elim="0" str="" l10="0-0" dr="0-0" cr="0-0" l="0" w="0" hr="0-0" ar="0-0" gb=""/> <t tid="1610612741" ta="CHI" tn="Bulls" tc="Chicago" see="" cli="0" elim="0" str="" l10="0-0" dr="0-0" cr="0-0" l="0" w="0" hr="0-0" ar="0-0" gb=""/> <t tid="1610612749" ta="MIL" tn="Bucks" tc="Milwaukee" see="" cli="0" elim="0" str="" l10="0-0" dr="0-0" cr="0-0" l="0" w="0" hr="0-0" ar="0-0" gb=""/> <t tid="1610612754" ta="IND" tn="Pacers" tc="Indiana" see="" cli="0" elim="0" str="" l10="0-0" dr="0-0" cr="0-0" l="0" w="0" hr="0-0" ar="0-0" gb=""/> <t tid="1610612765" ta="DET" tn="Pistons" tc="Detroit" see="" cli="0" elim="0" str="" l10="0-0" dr="0-0" cr="0-0" l="0" w="0" hr="0-0" ar="0-0" gb=""/> </di> <di val="Southeast"> <t tid="1610612737" ta="ATL" tn="Hawks" tc="Atlanta" see="" cli="0" elim="0" str="" l10="0-0" dr="0-0" cr="0-0" l="0" w="0" hr="0-0" ar="0-0" gb=""/> <t tid="1610612748" ta="MIA" tn="Heat" tc="Miami" see="" cli="0" elim="0" str="" l10="0-0" dr="0-0" cr="0-0" l="0" w="0" hr="0-0" ar="0-0" gb=""/> <t tid="1610612753" ta="ORL" tn="Magic" tc="Orlando" see="" cli="0" elim="0" str="" l10="0-0" dr="0-0" cr="0-0" l="0" w="0" hr="0-0" ar="0-0" gb=""/> <t tid="1610612764" ta="WAS" tn="Wizards" tc="Washington" see="" cli="0" elim="0" str="" l10="0-0" dr="0-0" cr="0-0" l="0" w="0" hr="0-0" ar="0-0" gb=""/> <t tid="1610612766" ta="CHA" tn="Bobcats" tc="Charlotte" see="" cli="0" elim="0" str="" l10="0-0" dr="0-0" cr="0-0" l="0" w="0" hr="0-0" ar="0-0" gb=""/> </di> </co> <co val="West"> <di val="Northwest"> <t tid="1610612743" ta="DEN" tn="Nuggets" tc="Denver" see="" cli="0" elim="0" str="" l10="0-0" dr="0-0" cr="0-0" l="0" w="0" hr="0-0" ar="0-0" gb=""/> <t tid="1610612750" ta="MIN" tn="Timberwolves" tc="Minnesota" see="" cli="0" elim="0" str="" l10="0-0" dr="0-0" cr="0-0" l="0" w="0" hr="0-0" ar="0-0" gb=""/> <t tid="1610612757" ta="POR" tn="Trail Blazers" tc="Portland" see="" cli="0" elim="0" str="" l10="0-0" dr="0-0" cr="0-0" l="0" w="0" hr="0-0" ar="0-0" gb=""/> <t tid="1610612760" ta="OKC" tn="Thunder" tc="Oklahoma City" see="" cli="0" elim="0" str="" l10="0-0" dr="0-0" cr="0-0" l="0" w="0" hr="0-0" ar="0-0" gb=""/> <t tid="1610612762" ta="UTA" tn="Jazz" tc="Utah" see="" cli="0" elim="0" str="" l10="0-0" dr="0-0" cr="0-0" l="0" w="0" hr="0-0" ar="0-0" gb=""/> </di> <di val="Pacific"> <t tid="1610612744" ta="GSW" tn="Warriors" tc="Golden State" see="" cli="0" elim="0" str="" l10="0-0" dr="0-0" cr="0-0" l="0" w="0" hr="0-0" ar="0-0" gb=""/> <t tid="1610612746" ta="LAC" tn="Clippers" tc="Los Angeles" see="" cli="0" elim="0" str="" l10="0-0" dr="0-0" cr="0-0" l="0" w="0" hr="0-0" ar="0-0" gb=""/> <t tid="1610612747" ta="LAL" tn="Lakers" tc="Los Angeles" see="" cli="0" elim="0" str="" l10="0-0" dr="0-0" cr="0-0" l="0" w="0" hr="0-0" ar="0-0" gb=""/> <t tid="1610612756" ta="PHX" tn="Suns" tc="Phoenix" see="" cli="0" elim="0" str="" l10="0-0" dr="0-0" cr="0-0" l="0" w="0" hr="0-0" ar="0-0" gb=""/> <t tid="1610612758" ta="SAC" tn="Kings" tc="Sacramento" see="" cli="0" elim="0" str="" l10="0-0" dr="0-0" cr="0-0" l="0" w="0" hr="0-0" ar="0-0" gb=""/> </di> <di val="Southwest"> <t tid="1610612740" ta="NOP" tn="Pelicans" tc="New Orleans" see="" cli="0" elim="0" str="" l10="0-0" dr="0-0" cr="0-0" l="0" w="0" hr="0-0" ar="0-0" gb=""/> <t tid="1610612742" ta="DAL" tn="Mavericks" tc="Dallas" see="" cli="0" elim="0" str="" l10="0-0" dr="0-0" cr="0-0" l="0" w="0" hr="0-0" ar="0-0" gb=""/> <t tid="1610612745" ta="HOU" tn="Rockets" tc="Houston" see="" cli="0" elim="0" str="" l10="0-0" dr="0-0" cr="0-0" l="0" w="0" hr="0-0" ar="0-0" gb=""/> <t tid="1610612759" ta="SAS" tn="Spurs" tc="San Antonio" see="" cli="0" elim="0" str="" l10="0-0" dr="0-0" cr="0-0" l="0" w="0" hr="0-0" ar="0-0" gb=""/> <t tid="1610612763" ta="MEM" tn="Grizzlies" tc="Memphis" see="" cli="0" elim="0" str="" l10="0-0" dr="0-0" cr="0-0" l="0" w="0" hr="0-0" ar="0-0" gb=""/> </di> </co> </scales> XML; $xml=simplexml_load_string($str); foreach($xml->xpath('//di/t[@scid="CHI"]/@tn') as $t) { echo $t; }
Output for 5.2.14 - 5.2.17, 5.3.3 - 5.3.6, 5.3.9 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
Output for 5.2.3 - 5.2.13, 5.3.0 - 5.3.2, 5.3.7 - 5.3.8
Warning: Invalid argument supplied for foreach() in /in/W2o8D on line 53
Output for 5.0.0 - 5.1.1, 5.1.3 - 5.2.2
<br /> <b>Warning</b>: Invalid argument supplied for foreach() in <b>/in/W2o8D</b> on line <b>53</b><br />
Output for 5.1.2
<br /> <b>Warning</b>: Invalid argument supplied for foreach() in <b>/in/W2o8D</b> on line <b>54</b><br />
Output for 4.4.5 - 4.4.9
<br /> <b>Fatal error</b>: Call to undefined function: simplexml_load_string() in <b>/in/W2o8D</b> on line <b>52</b><br />
Process exited with code 255.
Output for 4.3.2 - 4.4.1, 4.4.3 - 4.4.4
<br /> <b>Fatal error</b>: Call to undefined function: simplexml_load_string() in <b>/in/W2o8D</b> on line <b>52</b><br />
Process exited with code 255.
Output for 4.4.2
<br /> <b>Fatal error</b>: Call to undefined function: simplexml_load_string() in <b>/in/W2o8D</b> on line <b>53</b><br />
Process exited with code 255.
Output for 4.3.0 - 4.3.1
<br /> <b>Fatal error</b>: Call to undefined function: simplexml_load_string() in <b>/in/W2o8D</b> on line <b>52</b><br />