我想用php簡單的xml解析一些這樣的樹。php簡單的xml孩子點數加
如何加上所有的tree->item->object->num
?
我想獲得一個int 16
(2 + 4 + 7 + 2 + 1
)
<tree> <item> <object> <num>2</num> </object> <object> <num>4</num> </object> </item> <item> <object> <num>7</num> </object> <object> <num>2</num> </object> </item> <item> <object> <num>1</num> </object> </item> </tree>