| Posted by Janwillem Borleffs on 06/02/05 14:52 
adam wrote:> the XML documents i'm working with are all very simple, in that all
 > data is a child of one element. rather than typing the element over and
 > over, i figured i'd do:
 >
 >
 > $xml = simplexml_load_string($rdata);
 >
 > function display($request) {
 > echo $xml->parenttag->$request;
 > }
 >
 > display("product_number");
 >
 >
 > this produces no output.
 >
 
 You forgot to globalize $xml:
 
 function display($request) {
 global $xml;
 ...
 }
 
 See: http://www.php.net/global
 
 
 JW
 [Back to original message] |