I am running some queries against an API that will return an XML string, which I then convert to a SimpleXMLObject in PHP. The problem I am having is I can't access certain values. I will have a very strange structure that won't let me access the values I need. Here is an example of the output of one of the objects.
[totalCostOfFees] => SimpleXMLElement Object
(
[0] => 0
)
How would I get the value of that? I have one that is...
echo "<pre>";
print_r($var);
echo "</pre>";
<pre>Array
(
[26105] => Array
(
[rate request] => Array
(
[success] => 1
[cost] => SimpleXMLElement Object
(
[0] => 30
)
...
I can get to the "cost" section, but I am always left with array(0 => 30); I need the value, not the array. Obviously I can't use
$variable[$id]['cost']->0; // that will fail for obvious reasons
and I have tried..
$variable[$id]['cost'][0];
But that gives me an empty array. Please help, it is driving me nuts. Thank you.