3v4l.org

run code in 300+ PHP versions simultaneously
<?php $xml = <<< EOT <?xml version='1.0' encoding='UTF-8'?> <char cp="0000" age="1.1" na="" JSN="" gc="Cc" ccc="0" dt="none" dm="#" nt="None" nv="NaN" bc="BN" bpt="n" bpb="#" Bidi_M="N" bmg="" suc="#" slc="#" stc="#" uc="#" lc="#" tc="#" scf="#" cf="#" jt="U" jg="No_Joining_Group" ea="N" lb="CM" sc="Zyyy" scx="Zyyy" Dash="N" WSpace="N" Hyphen="N" QMark="N" Radical="N" Ideo="N" UIdeo="N" IDSB="N" IDST="N" hst="NA" DI="N" ODI="N" Alpha="N" OAlpha="N" Upper="N" OUpper="N" Lower="N" OLower="N" Math="N" OMath="N" Hex="N" AHex="N" NChar="N" VS="N" Bidi_C="N" Join_C="N" Gr_Base="N" Gr_Ext="N" OGr_Ext="N" Gr_Link="N" STerm="N" Ext="N" Term="N" Dia="N" Dep="N" IDS="N" OIDS="N" XIDS="N" IDC="N" OIDC="N" XIDC="N" SD="N" LOE="N" Pat_WS="N" Pat_Syn="N" GCB="CN" WB="XX" SB="XX" CE="N" Comp_Ex="N" NFC_QC="Y" NFD_QC="Y" NFKC_QC="Y" NFKD_QC="Y" XO_NFC="N" XO_NFD="N" XO_NFKC="N" XO_NFKD="N" FC_NFKC="#" CI="N" Cased="N" CWCF="N" CWCM="N" CWKCF="N" CWL="N" CWT="N" CWU="N" NFKC_CF="#" InSC="Other" InMC="NA" blk="ASCII" isc="" na1="NULL"> <namealias alias="NUL" type="abbreviation" /> <namealias alias="NULL" type="control" /> </char> EOT; $simpleXML = simplexml_load_string($xml); // Load XML string data into the simplexml object parser foreach ($simpleXML->result->rowset->row as $row) { $titles = []; $name = $row['name']->__toString(); foreach($row as $attrib){ if($attrib['name']->__toString() === 'titles'){ foreach($attrib as $title){ $titles[] = $title['titleName']->__toString(); } } } echo $name . ' : ' . implode(' - ', $titles) . "<br/>\n"; }
Output for git.master, git.master_jit, rfc.property-hooks
Warning: Attempt to read property "row" on null in /in/62Qv4 on line 25 Warning: foreach() argument must be of type array|object, null given in /in/62Qv4 on line 25

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
42.03 ms | 401 KiB | 8 Q