note 98444 added to simplexmlelement.count

From: Date: Wed, 16 Jun 2010 03:17:34 +0000
Subject: note 98444 added to simplexmlelement.count
Groups: php.notes 
Request: Send a blank email to php-notes+get-170163@lists.php.net to get a copy of this message
Apologize...above code used wrong escape sequence for literal double quotes. Corrected below... <?php $url = "http://www.example.com/foo.xml"; $xml = simplexml_load_file($url); // For debugging // echo "<p>".phpversion()."</p>"; if(phpversion() >= '5.3.0'){ $bar_count = $xml->foo->bar->count(); } else { $doc = new DOMDocument(); $str = $xml->asXML(); $doc->loadXML($str); $bar_count = $doc->getElementsByTagName("bar")->length; } echo "There are ".$bar_count." \"bar\" nodes in this document.<br />"; ?> ---- Server IP: 69.147.83.197 Probable Submitter: 99.156.151.35 ---- Manual Page -- http://www.php.net/manual/en/simplexmlelement.count.php Edit -- https://master.php.net/note/edit/98444 Del: integrated -- https://master.php.net/note/delete/98444/integrated Del: useless -- https://master.php.net/note/delete/98444/useless Del: bad code -- https://master.php.net/note/delete/98444/bad+code Del: spam -- https://master.php.net/note/delete/98444/spam Del: non-english -- https://master.php.net/note/delete/98444/non-english Del: in docs -- https://master.php.net/note/delete/98444/in+docs Del: other reasons-- https://master.php.net/note/delete/98444 Reject -- https://master.php.net/note/reject/98444 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#170163) next »