note 100273 deleted from simplexmlelement.count by danbrown

From: Date: Tue, 05 Oct 2010 15:20:28 +0000
Subject: note 100273 deleted from simplexmlelement.count by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-172974@lists.php.net to get a copy of this message
Note Submitter: Anonymous ---- @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

« previous php.notes (#172974) next »