Re: Easy way to grab a value out of XML?

From: Date: Sat, 02 Apr 2005 09:17:51 +0000
Subject: Re: Easy way to grab a value out of XML?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-212078@lists.php.net to get a copy of this message
Brian Dunning wrote:
I've been looking at the XML commands and am feeling a bit overwhelmed. My needs are simple and I'm hoping there's an easy solution that I'm just missing. I have a hunk of well-formed XML in a variable, $xml, and it contains only one instance of <price>x.xx</price>. I just want to get the $price out of $xml. What's the simplest way?
$xml = "...."; preg_match_all("|<price>(.*?)</price>|mi",$xml,$results); echo $results[1];

« previous php.general (#212078) next »