note 100273 added to simplexmlelement.count

From: Date: Tue, 05 Oct 2010 15:17:05 +0000
Subject: note 100273 added to simplexmlelement.count
Groups: php.notes 
Request: Send a blank email to php-notes+get-172973@lists.php.net to get a copy of this message
@Jimmy New Tron, or just use count($xml->children()) to achieve the same effect? <?php $url = "http://www.example.com/foo.xml"; $xml = simplexml_load_file($url); if (phpversion() >= '5.3.0') { $bar_count = $xml->foo->bar->count(); } else { $bar_count = count($xml->foo->bar->children()); } echo "There are $bar_count. \"bar\" nodes in this document."; ?> Tested on PHP 5.2.13 ---- Server IP: 87.124.126.138 Probable Submitter: 81.111.40.248 (proxied: 81.111.40.248) ---- Manual Page -- http://www.php.net/manual/en/simplexmlelement.count.php Edit -- https://master.php.net/note/edit/100273 Del: integrated -- https://master.php.net/note/delete/100273/integrated Del: useless -- https://master.php.net/note/delete/100273/useless Del: bad code -- https://master.php.net/note/delete/100273/bad+code Del: spam -- https://master.php.net/note/delete/100273/spam Del: non-english -- https://master.php.net/note/delete/100273/non-english Del: in docs -- https://master.php.net/note/delete/100273/in+docs Del: other reasons-- https://master.php.net/note/delete/100273 Reject -- https://master.php.net/note/reject/100273 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#172973) next »