JSON data
"orders":[
"billing_details":{
"company":"Test Company",
"firstname":"Munadil",
"postcode":"5000",
"street":"Dhaka, Bangladesh",
"email":"munadil98@gmail.com",
"lastname":"Fahad",
"ph_number":"880191111111",
"city":"Dhaka",
"state":"Mirpur",
"country_code":"BN",
"user_id":16003511,
"salutation":null
}]
In PHP
$json_output = json_decode($response);
foreach ( $json_output->orders as $orders ){
foreach ($orders->billing_details as $billing_details) {echo "<b>Name:</b><br>".$billing_details->firstname." ".$billing_details->lastname."<br>";}
}
But I am getting below error message,
Notice: Trying to get property of non-object in ....
How can I echo data inside "billing_details" object under array "orders" ?