Hi !
How do i stock an array state, knowing that if i write array_1=array_0 and then sort array_0, array_1 is sorted too ?
Thanx for your help !
Stock an array state...
Moderator: General Moderators
-
programmermatt
- Forum Commoner
- Posts: 65
- Joined: Tue Mar 15, 2005 5:03 pm
- Contact:
I am not sure how far pointers (or are they called references in PHP?) go in PHP, but I believe this should work:
Not sure of the parameters or if array_sort is a valid function, but you get the idea.
Code: Select all
$array1 = array('b','c','e','a');
$array2 =& $array1;
array_sort($array2);
// $array2 == $array1Thanx for your answers !
I begin with an array : array_0.
I write array_1=array_0, to stock the (order of the) values of array_0 in array_1.
I sort array _0 : array_1 is sorted too, what i don't want.
Look at http://d.braschi-blondeau.chez.tiscali. ... bj=comptes
click on the first line of the table to see the array original order.
Click on the second line to change the order.
Click on the first line : the order as changed, what i dont want (i want the first line to put the table in the original order.
I begin with an array : array_0.
I write array_1=array_0, to stock the (order of the) values of array_0 in array_1.
I sort array _0 : array_1 is sorted too, what i don't want.
Look at http://d.braschi-blondeau.chez.tiscali. ... bj=comptes
click on the first line of the table to see the array original order.
Click on the second line to change the order.
Click on the first line : the order as changed, what i dont want (i want the first line to put the table in the original order.
- harrisonad
- Forum Contributor
- Posts: 288
- Joined: Fri Oct 15, 2004 4:58 am
- Location: Philippines
- Contact:
Thanx for your answers !
In the end i used array_1=array_0.concat()
see http://d.braschi-blondeau.chez.tiscali. ... obj=global
In the end i used array_1=array_0.concat()
see http://d.braschi-blondeau.chez.tiscali. ... obj=global