I have an array with this structure:
array(4) {
[0]=> array(x) {
[0]=> string(x)"London"
[1]=> string(xx) "John"}
[1]=> array(x) {
[0]=> string(x)"London"
[1]=> string(xx) "Charles"}
[2]=> array(x) {
[0]=> string(x)"Paris"
[1]=> string(xx) "Alan"}
[3]=> array(x) {
[0]=> string(x)"Paris"
[1]=> string(x) "Wayne"}
}
How can I display the array data in this order:
London
John | Charles
Paris
Alan | Wayne
This can be done with an unique multidimensional array? or should i have another array to select distinct cities?
I am talking about something like a loop with:
foreach ($cities as $city) {
echo '<div class="city">'.$city.'</div>';
for() {
echo '<div class="persons">'.$persons.'</div>';
}
}
thanks
Group your cities in a new array, then spit it out