hi,
i'm having a hellish adventure with PHP5 :xbones: i hope someone just can help me out on this... i'm desperate
All i want to do, is to get the index of the returned elements, so i can acess them and change them
$mangaLib = simplexml_load_file($mangaLibFile);
$mangaObj = $mangaLib->children($mangaURI);
$tmp = $mangaObj->xpath('//id[../@title="'.$title.'"][position()]'); // (1)
.... do magic here, to get $ind...
$mangaObj->manga[$ind]->volumes = 666; // (2)
(1) var_dump($tmp) returns:
array(1) {
[0]=>
object(SimpleXMLElement)#18 (1) {
[0]=>
string(3) "100" // value of id
}
}
(2) this is my objective, get the index and use it
volumes and id are on the same level
i really don't care about the id nodes value, what i want is its position, but PHP complained if i used it without id:
$tmp = $mangaObj->xpath('//[../@title="'.$title.'"][position()]');
isn't position() supposed to do something?! :glare: