I have an array of structure $arrname[‘name’][0,1,2,3,4,…], $arrname[‘city’][0,1,2,3,4,…], $arrname[‘state’][0,1,2,3,4,…] and if I do an asort($arrname[‘name’]) it performs the sort just fine by name and maintains the indexing so I can access the other elements by index.
But how do I now process the array since the index is out of order. Normally I would use a FOR statement processing from 0 to count but since the name array is no longer in index order, it wipes out the sort.
So I assume I need to process the name array sequentially and reference the other two elements by index which I would need to get from the name element. Is there a way in PHP to process the array sequentially by ordered name element and reference the index of the sorted name element?
Thanks