I have some XML to work with, something like this:
<admin_list>
<admin>
<name>user1</name>
<authentication_source>Local</authentication_source>
</admin>
<admin>
<name>user2</name>
<authentication_source>Local</authentication_source>
</admin>
</admin_list>
I can't seem to retrieve a specific admin though. The following:
$admin = "user1";
foreach ($subxml as $child) {
if ($child->admin->name == $admin) {
var_dump($child);
}
}
returns an array including both user1 and user2. How can I go about outputting the XML of only the selected user. (in this case user1) So my desired output is:
<admin>
<name>user1</name>
<authentication_source>Local</authentication_source>
</admin>
Thank you!