note 90526 added to function.simplexml-element-xpath

From: Date: Sun, 26 Apr 2009 21:02:31 +0000
Subject: note 90526 added to function.simplexml-element-xpath
Groups: php.notes 
Request: Send a blank email to php-notes+get-153789@lists.php.net to get a copy of this message
function OpenAndXpath($FilePath,$XpathQuery,$ArrayOrString) { //OpenAndXpath(Filename, Xpath, Return like a array or string) if (file_exists($FilePath)) { $xml = simplexml_load_file($FilePath); $result = $xml->xpath($XpathQuery); while(list( , $node) = each($result)) { $i++; if($ArrayOrString=="a") { $results[$i]=$node; } if($ArrayOrString=="t") { echo $node."<br/>"; } } if($ArrayOrString=="a") { return $results; } } else { exit('Failed to open '.$FilePath); return false; } } print_r( OpenAndXpath('dokument.xml','//title','a')); ---- Server IP: 212.24.129.51 Probable Submitter: 88.102.115.201 ---- Manual Page -- http://www.php.net/manual/en/function.simplexml-element-xpath.php Edit -- https://master.php.net/note/edit/90526 Del: integrated -- https://master.php.net/note/delete/90526/integrated Del: useless -- https://master.php.net/note/delete/90526/useless Del: bad code -- https://master.php.net/note/delete/90526/bad+code Del: spam -- https://master.php.net/note/delete/90526/spam Del: non-english -- https://master.php.net/note/delete/90526/non-english Del: in docs -- https://master.php.net/note/delete/90526/in+docs Del: other reasons-- https://master.php.net/note/delete/90526 Reject -- https://master.php.net/note/reject/90526 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#153789) next »