XML Tag Attributes in PHP

Now let the tag have attributes:

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

To get the attribute value, you need to access $xml->tag as an array:

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

However, if you simply output $xml->tag, you will get the tag text:

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

Given the following XML:

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

Display the user's name, age, and salary.