i am using SimpleXML for very basic xml structure and after finding my specific value i just cannot get it out from the result. below is my code
$xml = new SimpleXMLElement($xmlStr);
foreach($values['type'] as $type)
{
$res = $xml->xpath("/domains/type[name='$type']/price");
$price = (isset($res[0][0]))? $res[0][0] : 'US 0.0' ;
$domain = $dname.$type;
if( !checkdnsrr($domain) ){
$avails[$domain]['available'] = 'yes';
$avails[$domain]['price'] = $price;
}
else
$avails[$domain] = 'no';
}
echo '<pre>';
print_r($avails);
echo '</pre>';
Below is the out put.
Array (
[eee.com] => no
[eee.net] => Array
( Blockquote
[available] => yes
[price] => SimpleXMLElement Object
(
[0] => US $20
)
)
How can i get rid of that SimpleXMLElement Object and only have the value of it in price .?
Should work.
EDIT: Unless, of course, there can be multiple prices, in which case, you want to do a
foreachof some sorts.