Working only on a copy of an array?
Posted: Thu Mar 03, 2005 3:15 pm
Im working with some arrays and sorting its values with multisort.
I have an initial array that i want to sort several times in different places of my script (always from the original array), but for the second time I want to sort it is already sorted by the first sort operation.
Code is something like this:
and i thought I would be only sorting rank1 and rank2, just copies of array $vendedor, but when I look at results I see $vendedor array sorted as well.. Any way of just sorting a copy of an array and not the original array?
Thank you.
I have an initial array that i want to sort several times in different places of my script (always from the original array), but for the second time I want to sort it is already sorted by the first sort operation.
Code is something like this:
Code: Select all
$rank1 = $vendedor;
//Fisrt Ranking
array_multisort($neto, SORT_DESC, $rank1);
.
.
.
.
$rank2 = $vendedor;
//Second Ranking
array_multisort($ventas, SORT_DESC, $rank2);Thank you.