我有一段XML数据如下:
<scientist>
<name>Emmy Noether&Amalie</name>
</scientist>
<day>
<date>03-23-2015</date>
<wiki>Emmy Noether&Amalie was an influential German mathematician known for her groundbreaking contributions to abstract algebra and theoretical physics. Emmy Noether&Amalie was born on 23 March 1882, the first of four children. In 1932 Emmy Noether and Emil Artin received the Ackermann–Teubner Memorial Award for their contributions to mathematics.</wiki>
</day>
我的问题是如何计算name
的{{1}}值(即scientist
)在上述XML元素的Emmy Noether&Amalie
元素中重复的次数?谢谢你的帮助。
答案 0 :(得分:0)
您使用SimpleXML来解析XML吗?
如果您隔离了所有wiki标记,则可以使用substr_count函数计算名称标记出现次数