Olmayan bir nesne üzerinde (bir üye işlev xpath Call): XPath'daki Döngü () Yapımı

0 Cevap php

Ben bu fonksiyon ile XPath ile döngü () yapmak istiyorum:

function rs(){

$rs = array();
$cities = array("city1", "city2", "city3", "city4", "city5",
    "city6", "city7", "city8");
foreach ($cities as $value) {

    $rs[] = $xmls->xpath("area[city= '$value']");

}
return $rs; }

$rs = rs();

Edit:

function meteor(){

$request_url = "http://meteoroloji.gov.tr/FTPDATA/analiz/sonSOA.xml";
$xml = simplexml_load_file($request_url) or die("feed not loading");
return $xml;}
$xmls = meteor();

with print_r($rs); I have Fatal error: Call to a member function xpath() on a non-object. Is my function wrong? (Im not familliar with OOP) Thanks in advance

0 Cevap