PHP count()函数讲解
(编辑:jimmy 日期: 2025/11/13 浏览:3 次 )
PHP count() 函数
实例
计算 car 节点的子节点个数:
<"Volvo">
<child/>
<child/>
<child/>
<child/>
</car>
<car name="BMW">
<child/>
<child/>
</car>
</cars>
XML;
$elem=new SimpleXMLElement($xml);
foreach ($elem as $car)
{
printf("%s has %d children.<br>", $car['name'], $car->count());
}
"htmlcode">
count();
总结
以上就是这篇文章的全部内容了,希望本文的内容对大家的学习或者工作具有一定的参考学习价值,谢谢大家对的支持。如果你想了解更多相关内容请查看下面相关链接
下一篇:PHP getDocNamespaces()函数讲解
