I am trying to read an XML output listed below:
SimpleXMLElement Object
(
[merchant] => SimpleXMLElement Object
(
[merchant-id] => SimpleXMLElement Object
(
)
[merchant-name] => Snip-Its
[merchant-category] => Hair
[merchant-website] => www.snipits.com
)
[store] => SimpleXMLElement Object
(
[store-id] => 173DFBB7-67F6-DE11-AD5B-0026B953348A
[store-name] => Heb
[store-number] => 0109
)
[coupon] => SimpleXMLElement Object
(
[coupon-id] => 385748
[coupon-address] => 14096 Memorial Drive
[coupon-city] => Houston
[coupon-state] => TX
)
)
using PHP script as follows but I get a value of '0':
foreach( $data->coupons as $mycoupon ) {
$address = $mycoupon->coupon->coupon-address;
//print_r($mycoupon);
}
So, please help me to understand how to read the values of SimpleXMLElement Object and assign them to a local variable.