- simplexml_load_string: documentation ( source)
- reset: documentation ( source)
- print_r: documentation ( source)
<?php
$xml = simplexml_load_string('
<person>
<profile>
<name>PHP developer</name>
</profile>
</person>');
// get all names
$xml = $xml->xpath('/person/profile/name');
// get first result
$xml = reset($xml);
// show result
print_r($xml);