最新消息:XAMPP默认安装之后是很不安全的,我们只需要点击左方菜单的 "安全"选项,按照向导操作即可完成安全设置。

如何计算使用PHP在另一个数组元素中重复数组值的次数?

XAMPP案例 admin 604浏览 0评论

我有一段XML数据如下:

<scientist>
  <name>Emmy Noether&amp;Amalie</name>
</scientist>

<day>
  <date>03-23-2015</date>
  <wiki>Emmy Noether&amp;Amalie was an influential German mathematician known for her groundbreaking contributions to abstract algebra and theoretical physics. Emmy Noether&amp;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&amp;Amalie元素中重复的次数?谢谢你的帮助。

1 个答案:

答案 0 :(得分:0)

您使用SimpleXML来解析XML吗?

如果您隔离了所有wiki标记,则可以使用substr_count函数计算名称标记出现次数

转载请注明:XAMPP中文组官网 » 如何计算使用PHP在另一个数组元素中重复数组值的次数?

您必须 登录 才能发表评论!