With SimpleXML, you can get :
- sub-elements, using object notation :
$element->subElement
- and attributes, using array notation :
$element['attribute']
So, here, I’d say you’d have to use :
echo $child['name'];
As a reference, and for a couple of examples, see the Basic usage section of simplexml’s manual.
Example #6 should be the interesting one, about attributes.