Hi i have a problems with simplexml_load_file, i'm not pretty sure how to do to order my array by a $item->padre.
I need to do foreach and order by $item->padre.=, i don't know how to do this.
function create_sitemap($sitemap){
$xml = file_exists('sitemap.xml') ? $xml = simplexml_load_file('sitemap.xml'): exit('Failed to open sitemal.xml.');
$xml = uasort($xml, function($a,$b){ return strcmp($a->padre, $b->padre); });
foreach ($xml->url as $item) {
echo "<p>" . $item->loc. "</p>";
echo "<p>" . $item->padre . "</p>";
}
}
Thanks in advance.