I have an XML files of sports events (see below). Some of the events have the same match name, so I’ve put everything into an array and then tried to match them using matchname as a key.
The XML looks like this:
[CODE]FootballRed League201311021245Town Rovers vs Chanellink1.htmllink2.html
FootballRed League201311021245Town Rovers vs Chanellink3c.htmllink4.html[/CODE]
Here’s my PHP code (I’m pulling in the XML file using SimpleXML)…
$xml = simplexml_load_file(‘test3.xml’);
$aCopy = array();
foreach ($xml->match AS $match)
$aCopy[(string)$match->matchname] = $match;
foreach ($match->linkset->link AS $link)
The code above seems to have gotten me 80% of the way in that they are matching ok and the links output ok. But the weird thing is the attributes on the 2nd instance of the match aren’t outptting…
Link 1 en 300 link1.html
Link 2 en 350 link2.html
[blank] [blank] [blank] link3.html
[blank] [blank] [blank] link4.hmtl
(Where [blank] is supposed to be the channelname, lang and kbps outputted attributes)
Any suggestions on what I might be doing wrong here?
Thanks in advance for any help you can offer.