note 82735 added to simplexml.examples

From: Date: Wed, 23 Apr 2008 19:34:44 +0000
Subject: note 82735 added to simplexml.examples
Groups: php.notes 
Request: Send a blank email to php-notes+get-138712@lists.php.net to get a copy of this message
@david b's approach of dynamically accessing xml-elements: You can explode the dynamic var with '->' as seperator and thus build a simple function to get the element function simplexml_get_node_by_query($sxml_obj, $query) { $nodes = explode("->", $query); $currTree = $sxml_obj; foreach($nodes as $node) { $currTree = $currTree->$node; } return $currTree; } ---- Server IP: 217.160.72.57 Probable Submitter: 78.49.252.52 ---- Manual Page -- http://www.php.net/manual/en/simplexml.examples.php Edit -- https://master.php.net/note/edit/82735 Del: integrated -- https://master.php.net/note/delete/82735/integrated Del: useless -- https://master.php.net/note/delete/82735/useless Del: bad code -- https://master.php.net/note/delete/82735/bad+code Del: spam -- https://master.php.net/note/delete/82735/spam Del: non-english -- https://master.php.net/note/delete/82735/non-english Del: in docs -- https://master.php.net/note/delete/82735/in+docs Del: other reasons-- https://master.php.net/note/delete/82735 Reject -- https://master.php.net/note/reject/82735 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#138712) next »