XML žymės atributai PHP

Tarkime, kad žymė dabar turi atributus:

test.xml<root>
  <tag attr="val">text</tag>
</root>

Gaukime atributo reikšmę. Tam reikia kreiptis į $xml->tag kaip į masyvą:

index.php<?php
  echo $xml->tag['attr']; // išves 'val'
?>

Be to, jei tiesiog išvesime $xml->tag, tai gausime žymės tekstą:

index.php<?php
  echo $xml->tag; // išves 'text'
?>
Задание 1

Duotas toks XML:

html<root>
  <user age="23" salary="1000">john</user>
</root>

Išveskite ekrane vartotojo vardą, amžių ir atlyginimą.