0514-86177077
9:00-17:00(工作日)
PHP count() 函數(shù)
實例
計算 car 節(jié)點的子節(jié)點個數(shù):
?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()函數(shù)計算指定節(jié)點的子節(jié)點個數(shù)。
count()
語法
count();
總結(jié)
以上就是這篇文章的全部內(nèi)容了,希望本文的內(nèi)容對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,謝謝大家對腳本之家的支持。如果你想了解更多相關(guān)內(nèi)容請查看下面相關(guān)鏈接
標簽:寧夏 吐魯番 徐州 荊門 常州 遵義 武威 遂寧
上一篇:PHP getDocNamespaces()函數(shù)講解
下一篇:PHP simplexml_import_dom()函數(shù)講解
Copyright ? 1999-2012 誠信 合法 規(guī)范的巨人網(wǎng)絡(luò)通訊始建于2005年
蘇ICP備15040257號-8