- simplexml_load_string: documentation ( source)
<?php
$xml = <<<END
<?xml version="1.0"?>
<foo>
<bar number="one"><say>hello</say></bar>
<bar number="two"><say>how are you?</say></bar>
<bar number="three"><say>very well</say></bar>
<bar number="four"><say>good bye</say></bar>
</foo>
END;
$sx = simplexml_load_string($xml);
echo $sx->xpath('*[@number="three"]')[0]->say;