0514-86177077
9:00-17:00(工作日)
PHP count() 函数
实例
计算 car 节点的子节点个数:
?php $xml=XML cars> car name="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()); } ?>
定义和用法
count()函数计算指定节点的子节点个数。
count()
语法
count();
总结
以上就是这篇文章的全部内容了,希望本文的内容对大家的学习或者工作具有一定的参考学习价值,谢谢大家对脚本之家的支持。如果你想了解更多相关内容请查看下面相关链接
标签:宁夏 吐鲁番 徐州 荆门 常州 遵义 武威 遂宁
上一篇:PHP getDocNamespaces()函数讲解
下一篇:PHP simplexml_import_dom()函数讲解