note 115726 added to simplexmlelement.xpath

From: Date: Sat, 13 Sep 2014 13:36:46 +0000
Subject: note 115726 added to simplexmlelement.xpath
Groups: php.notes 
Request: Send a blank email to php-notes+get-200437@lists.php.net to get a copy of this message
If you want to search multiple values from xml on the behalf or one value then this code can be helpfull to you. if there is: <Record> <country>Pakistan</country> <code>+92</code> <Value>100<Value> </Record> then try this one: <?php $sxe = simplexml_load_file("countries.XML"); foreach($sxe->xpath('//RECORD') as $item) { $v = $row->xpath('./country[. ="Pakistan"]'); if($v[0]){ print $item->country; print $item->code; print $item->value; } } ?> ---- Server IP: 72.52.91.14 Probable Submitter: 149.172.152.229 ---- Manual Page -- http://php.net/manual/en/simplexmlelement.xpath.php Edit -- https://master.php.net/note/edit/115726 Del: integrated -- https://master.php.net/note/delete/115726/integrated Del: useless -- https://master.php.net/note/delete/115726/useless Del: bad code -- https://master.php.net/note/delete/115726/bad+code Del: spam -- https://master.php.net/note/delete/115726/spam Del: non-english -- https://master.php.net/note/delete/115726/non-english Del: in docs -- https://master.php.net/note/delete/115726/in+docs Del: other reasons-- https://master.php.net/note/delete/115726 Reject -- https://master.php.net/note/reject/115726 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#200437) next »