I would like to iterate through an xml document to get its values. See the given code
foreach ($xml->children() as $key1=>$value1 /*($xml->children() as $second_gen)*/ ) {
echo ' 1 ' .$key1.' '.$value1.'<br>';
foreach ($second_gen as $key2=>$value2) {
echo ' ___2 ' .$key2.' '.$value2.'<br>';
}
}
So what I want to do is to make $second_gen
equals to the children of the each current iteration of the loop. I was able to do this by putting it in the foreach, but this prevented me from using key/value. So is there any solution to get both?
Thanks!