3v4l.org

run code in 300+ PHP versions simultaneously
<?php $str=<<<XML <scales> <di val="Atlantic"> <t tid="1610612752" ta="NYK" tn="Knicks" tc="New York" see="2" cli="1" elim="0" str="W 1" l10="8-2" dr="10-6" cr="37-15" l="28" w="54" hr="31-10" ar="23-18" gb="12"/> <t tid="1610612751" ta="BKN" tn="Nets" tc="Brooklyn" see="4" cli="1" elim="0" str="W 2" l10="7-3" dr="11-5" cr="36-16" l="33" w="49" hr="26-15" ar="23-18" gb="17"/> <t tid="1610612738" ta="BOS" tn="Celtics" tc="Boston" see="7" cli="1" elim="0" str="L 1" l10="4-6" dr="7-9" cr="27-24" l="40" w="41" hr="27-13" ar="14-27" gb="24.5"/> <t tid="1610612755" ta="PHI" tn="76ers" tc="Philadelphia" see="9" cli="0" elim="1" str="W 1" l10="5-5" dr="7-9" cr="22-30" l="48" w="34" hr="23-18" ar="11-30" gb="32"/> <t tid="1610612761" ta="TOR" tn="Raptors" tc="Toronto" see="10" cli="0" elim="1" str="W 5" l10="7-3" dr="5-11" cr="22-30" l="48" w="34" hr="21-20" ar="13-28" gb="32"/> </di> <di val="Central"> <t tid="1610612754" ta="IND" tn="Pacers" tc="Indiana" see="3" cli="1" elim="0" str="L 3" l10="5-5" dr="13-3" cr="31-20" l="32" w="49" hr="30-11" ar="19-21" gb="16.5"/> <t tid="1610612741" ta="CHI" tn="Bulls" tc="Chicago" see="5" cli="1" elim="0" str="W 2" l10="5-5" dr="9-7" cr="34-18" l="37" w="45" hr="24-17" ar="21-20" gb="21"/> <t tid="1610612749" ta="MIL" tn="Bucks" tc="Milwaukee" see="8" cli="1" elim="0" str="W 1" l10="3-7" dr="7-9" cr="24-28" l="44" w="38" hr="21-20" ar="17-24" gb="28"/> <t tid="1610612765" ta="DET" tn="Pistons" tc="Detroit" see="11" cli="0" elim="1" str="L 1" l10="5-5" dr="8-8" cr="25-27" l="53" w="29" hr="18-23" ar="11-30" gb="37"/> <t tid="1610612739" ta="CLE" tn="Cavaliers" tc="Cleveland" see="13" cli="0" elim="1" str="L 6" l10="2-8" dr="3-13" cr="18-34" l="58" w="24" hr="14-27" ar="10-31" gb="42"/> </di> </scales> XML; $xml=simplexml_load_string($str); foreach($xml->xpath('//scale[@gender="*" or @gender="m"][@age="*" or @age="39-59"]/d[@scid="hi"][@raw="10"]/@t') as $t) { echo $t; }
Output for 5.2.14 - 5.2.17, 5.3.3 - 5.3.6, 5.3.9 - 5.3.29, 5.4.0 - 5.4.45, 5.5.0 - 5.5.36, 5.6.0 - 5.6.28, 7.0.0 - 7.0.20, 7.1.0 - 7.1.10, 7.2.0 - 7.2.33, 7.3.12 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.27, 8.2.0 - 8.2.17, 8.3.0 - 8.3.4
Output for 5.0.0 - 5.0.5, 5.1.0 - 5.1.1, 5.1.3 - 5.1.6, 5.2.0 - 5.2.13, 5.3.0 - 5.3.2, 5.3.7 - 5.3.8
Warning: Invalid argument supplied for foreach() in /in/NCU4l on line 22
Output for 5.1.2
Warning: Invalid argument supplied for foreach() in /in/NCU4l on line 23
Output for 4.4.5 - 4.4.9
Fatal error: Call to undefined function: simplexml_load_string() in /in/NCU4l on line 21
Process exited with code 255.
Output for 4.3.2 - 4.3.11, 4.4.0 - 4.4.1, 4.4.3 - 4.4.4
Fatal error: Call to undefined function: simplexml_load_string() in /in/NCU4l on line 21
Process exited with code 255.
Output for 4.4.2
Fatal error: Call to undefined function: simplexml_load_string() in /in/NCU4l on line 22
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Call to undefined function: simplexml_load_string() in /in/NCU4l on line 21

preferences:
217.78 ms | 401 KiB | 341 Q