在具有指定属性的xml中计算childrens()

时间:2014-06-03 14:46:51

标签: php xml

我正在尝试计算具有closed=1closed=0

属性的孩子

我的目标是用1和0计算值,然后将其提取到两个不同的变量,如:

$countswithvalue1
$countswithvalue0

如何解决这个问题.-。

$url123 = 'http://steamcommunity.com/id/ProJaCore/stats/GarrysMod/?xml=1';
$data123 = file_get_contents($url123);

$elem = new SimpleXMLElement($data123);

foreach ($elem->achievements->xpath("achievement[@closed='1']") as $inha) {
    print $inha->count().'----';
}

先谢谢你...你可以看一下xml - > http://steamcommunity.com/id/ProJaCore/stats/GarrysMod/?xml=1

0 个答案:

没有答案