get attribute of xml in php

get attribute of xml in php

this is the attribute structure of xml

 [ForecastDay0] => SimpleXMLElement Object
 (
 [@attributes] => Array
 (
 [FDay] => 0
 [Date] => 2008-11-11T00:00:01.930
 [Name] => Tuesday
 )
 And this is the code to retrieve attribute
 foreach($xml->Forecasts->$weather->attributes() as $a => $b) {
 $FDay = $b;
 }
 echo "$FDay";

You may also like...

Creating a Shopify App using Laravel How to Create Custom WordPress Plugin? How to Build a Telegram Bot using PHP How to Convert Magento 2 into PWA?