Hi,
I would like to understand how to access a by its id and not trough array position, example,
I dont want to do this,
$myXML->someNameHere[1]->home[0]
I want to go access someNameHere by its ID "hi"
Thanks a lot for your atention, ;D
Hi,
I would like to understand how to access a by its id and not trough array position, example,
I dont want to do this,
$myXML->someNameHere[1]->home[0]
I want to go access someNameHere by its ID "hi"
Thanks a lot for your atention, ;D
You'll have to use XPath for that.
$nodes = $myXML->xpath('//*[@id="hi"]');
if (!empty($nodes))
{
$someNameHere = $nodes[0];
}