brooksh Posted March 18, 2012 Share Posted March 18, 2012 I'm pulling data from an xml file and I'm getting a lot of duplicates. How can I remove the duplicates from the query? foreach($xml->category->subcategory as $category){ echo $category[id]; }//end foreach Quote Link to comment https://forums.phpfreaks.com/topic/259195-duplicate-xml-data-returned-how-to-list-ony-unique-data/ Share on other sites More sharing options...
brooksh Posted March 18, 2012 Author Share Posted March 18, 2012 foreach($xml->category->subcategory as $category){ $filter_categoryid[] = trim($category['categoryId']); }//end foreach $filter_categoryid = array_unique($filter_categoryid); Quote Link to comment https://forums.phpfreaks.com/topic/259195-duplicate-xml-data-returned-how-to-list-ony-unique-data/#findComment-1328742 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.