I am pulling a value from a xml using PHP's simpleXML. When I echo the value it is fine, however when I store the value in a PHP variable and then do some math with it or even echo it, it does not return anything. I var_dumped the $_SESSION in which I stored the value and it shows: ["shippingPrice"]=> object(SimpleXMLElement)#6 (1) { [0]=> string(4) "5.60"
instead of diplaying just the 5.60 value.
How could I achieve this?
Here is my code:
$response = new SimpleXMLElement($result);
$shippingPrice = $response->Package->Postage->Rate;
$_SESSION['shippingPrice'] = $shippingPrice;
echo $shippingPrice;
echo $_SESSION['shippingPrice'];
Both echos are empty.
Thanks