mattspriggs28 Posted February 24, 2011 Share Posted February 24, 2011 I have converted xml into an array with no problems, however I'm having difficulty outputting the various attributes. Here is a sample: [0] => Array ( [@attributes] => Array ( [YourId] => 1082-1 [Name] => Woodwards Metals [Description] => ) ) The bit that is confusing me is the @attributes part. How would I output the 'Name' element for example? Link to comment https://forums.phpfreaks.com/topic/228686-outputting-array-elements/ Share on other sites More sharing options...
dreamwest Posted February 24, 2011 Share Posted February 24, 2011 http://www.wizecho.com/nav=php&s=xml Theres a good color coded example halfway down Link to comment https://forums.phpfreaks.com/topic/228686-outputting-array-elements/#findComment-1179054 Share on other sites More sharing options...
sasa Posted February 24, 2011 Share Posted February 24, 2011 <?php $test = array( 0 => Array( '@attributes' => Array( 'YourId' => '1082-1', 'Name' => 'Woodwards Metals', 'Description' => '' ) ) ); foreach($test as $a)echo $a['@attributes']['Name'], "<br />\n"; ?> Link to comment https://forums.phpfreaks.com/topic/228686-outputting-array-elements/#findComment-1179130 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.