我发现自己深入研究了 xml 提要,除了几个数组名称之外,它们几乎是相同的提要。
理想情况下,我想制作一种我可以调用的函数,但我不知道如何处理这种数据
//DRILLING DOWN TO THE PRICE ATTRIBUTE FOR EACH FEED & MAKING IT A WORKING VAR
$wh_odds = $wh_xml->response->will->class->type->market->participant;
$wh_odds_attrib = $wh_odds->attributes();
$wh_odds_attrib['odds'];
$lad_odds = $lad_xml->response->lad->class->type->market->participant;
$lad_odds_attrib = $lad_odds->attributes();
$lad_odds_attrib['odds'];
如您所见,它们本质上非常相似,但我不太确定如何简化设置工作变量的过程,而无需每次编写 3 行。