Hi.
Let's say I have the following...
$names = array("Frank", "John", "Dave");
$money = array(15, 25, 19);
for($i=1; $i <= 3, $i++)
{
cout $names[$i] . ": " . $money[$i] . "<br>";
}
The output will be this:
Frank: 15
John: 25
Dave: 19
Let's say that instead, I wanted these to be sorted in descending order by money, like this:
John: 25
Dave: 19
Frank: 15
How would I achieve this without running it all through a database and without changing the array items by hand (I have about 7500 array elements in my actual script, so that's not feasable)?
If I simply sort the money array in descending order, they obviously won't be paired with the names any longer.
Basically I want to change the index of my array, and change the index of the other array in the exact same arrangement. Would an array of classes be best? Is there any other way to do this?