⊗ppSpXmHN 28 of 83 menu

XML Tag Names With Hyphens in PHP

Suppose a tag name contains a hyphen:

<root> <tag> <elem-child>text</elem-child> </tag> </root>

In this case, to access such a tag, you will need to use the following technique:

<?php echo $xml->tag->{'elem-child'}; // 'text' ?>

Given the following XML:

<root> <user-name>john</user-name> <user-surn>smit</user-surn> </root>

Display the user's first and last name on the screen.

English
AfrikaansAzərbaycanБългарскиবাংলাБеларускаяČeštinaDanskDeutschΕλληνικάEspañolEestiSuomiFrançaisहिन्दीMagyarՀայերենIndonesiaItaliano日本語ქართულიҚазақ한국어КыргызчаLietuviųLatviešuМакедонскиMelayuမြန်မာNederlandsNorskPolskiPortuguêsRomânăРусскийසිංහලSlovenčinaSlovenščinaShqipСрпскиSrpskiSvenskaKiswahiliТоҷикӣไทยTürkmenTürkçeЎзбекOʻzbekTiếng Việt
We use cookies for website operation, analytics, and personalization. Data processing is carried out in accordance with the Privacy Policy.
accept all customize decline