Hi,
im parsing data coming from json
so the output is something like
rray
(
[0] => stdClass Object
(
[shipping_raw] => 7
[billing_address] => stdClass Object
(
[state] => abc
[phone] =>
[first_name] => def
[last_name] => ghi
[postal_code] => 3333
[city] => lars
[street1] => xxxxx
[street2] =>
[country] => US
[email] => xxxx@abc.com
)
[Shipping_address] = stdClass object
(
[state] => abc
[phone] =>
[first_name] => def
[last_name] => ghi
[postal_code] => 3333
[city] => lars
[street1] => xxxxx
[street2] =>
[country] => US
[email] => xxxx@abc.com
)
[total]=$5
[sub_total] = $5
}
i have script that parse the data. now the question is this how will i know if data being parse is shipping_address
the code is something like this
$result = json_decode($thejason);
$header= array('shipping_raw','shipping_address','total','subtotal'); // this is the property method that we need to display
foreach($result as $k)
{
foreach($header as $h)
{
if ((!s_object($k->$h)) // let us evaluate if the properties is object or not
{ echo $k->$h // display
}
else
{
// how would i know if the object is now pointing to "Shipping_address" which is object
}
}
}