Merlin wrote:
> Hi there,
> 
> I am trying to get continent and country info out of an xml file.
> There is a continent element to each country element. 
> 
> Now I do have an array with the continent info and one with the
> country info. The goal is to be able to output all countries sorted
> after continents. So I do have: $results[]->countryContinent
> $results[]->countryName   
> 
> I tryed to group those values, to do array searches and more, but
> somehow it looks like that there must be a way more easy way to do
> this. Maybe someone has a good hint how to solve that.  
> 
> Thanx for any help,
> 
> merlin

I would suggest parsing the XML data such that you have an array of
continents, and each element of said array is an array with two elements
- the first being the contintent name and the second array containing
all countries within that continent.

So, after parsing the file you would have:

$contintents[0] = array('North America',array('Canada','United
States','Mexico'));
$contintents[1] = array('South
America',array('Ecuador','Chile','Peru','Columbia','Brazil'));

etc. etc.

HTH.

Pablo.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to