I have an XML file similar to this:
<list> <ac val="505"> <ph val="1234567" /> <ph val="2345678" /> <ph val="3456789" /> </ac> </list>
I have tried to run it through a foreach loop to get each of the ph attributes (val) displayed.
I have tried numerous ways but this is my most recent fail:
<?php
// set name of XML file
$file = "donotcall.xml";
// load file
$xml = simplexml_load_file($file) or die ("Unable to load XML file!");
// access XML data
foreach($xml->ac->ph as $i)
{
echo "Number: " . $xml->ac->ph[$i]->attributes() . "\n<br />";
}
Thanks for any help!

New Topic/Question
Reply




MultiQuote






|