Arrays: Do x to y AND z
Posted: Wed Jan 19, 2011 10:28 am
So I'm kinda new to PHP.
I'm working with a couple arrays and I want to be able to sort them. The only problem is, they correspond (ie, one array is 'Names', the other is 'Passwords', the other is 'Favorite Colour' etc). So, for example, I want to be able to sort 'Favorite Colour' alphabetically and then have the other arrays be sorted not alphabetically but the same way Fav Colour was such that they correspond.
I understand the sort() function, I just want to know what the best way to do this is. While looking into it, I stumbled upon multidimensional arrays. Is that what I want? or something else?
I'm working with a couple arrays and I want to be able to sort them. The only problem is, they correspond (ie, one array is 'Names', the other is 'Passwords', the other is 'Favorite Colour' etc). So, for example, I want to be able to sort 'Favorite Colour' alphabetically and then have the other arrays be sorted not alphabetically but the same way Fav Colour was such that they correspond.
I understand the sort() function, I just want to know what the best way to do this is. While looking into it, I stumbled upon multidimensional arrays. Is that what I want? or something else?