- simplexml_load_string: documentation ( source)
<?php
$xml = "<Users>
<User _un='NewGuy'>
<UserInfo _pw='pass' _cr='0'/>
</User>
<User _un='Farach'>
<UserInfo _pw='anthony1121@gmail.co' _cr='0'/>
</User>
</Users>";
$xml = simplexml_load_string( $xml);
foreach( $xml->xpath( './/User') as $child) {
echo $child->attributes()['_un'] . "\n";
if($child->attributes()['_un'] = "Farach"){
echo $child->UserInfo->attributes()['_cr'];
}
}