Pyh.conf’25: a new PHP conference for the Russian-speaking community

Voting

: five minus five?
(Example: nine)

The Note You're Voting On

canuemail at gmail dot com
17 years ago
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) {

$row = simplexml_load_string($item->asXML());
$v = $row->xpath('//country[. ="Pakistan"]');
if(
$v[0]){
print
$item->country;
print
$item->code;
print
$item->value;
}

}
?>

<< Back to user notes page

To Top