How can the id attribute of the 2nd baz element from the XML string below be retrieved from the SimpleXML object found inside $xml?
One
Two
$xml->getElementById('2');
$xml->foo->bar->baz[2]['id']
$xml->foo->baz[2]['id']
$xml->foo->bar->baz[1]['id']
$xml->bar->baz[1]['id']
Submit