How to re-order an array
| From: | jekillen | Date: | Sat, 10 Jun 2006 01:44:58 +0000 |
| Subject: | How to re-order an array | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-237726@lists.php.net to get a copy of this message | ||
Hello;
i'm scratching my head with a difficulty.
The situation is this.
A script begins with one indexed array (not associative) and one other indexed array
with the same values in a different order, the final order.
I want to create an interim array and progressively re order the array until it matches
slot for slot one of the original arrays. At this point the script is considered completed.
One important factor is that I'm looking to write this in javascript and the interim
array will be altered by the actions of a web page user.
Why am I asking the php list? Because I have a better chance of getting an answer
here. I'm not looking for help with javascript, specifically, just how one would go about
this task. Answer with php code and some theory if you wish and I will try to translate
it into javascript.
Some javascript functions I might use aren't supported in all the browsers that will
potentially run the script.
I might resort to using Ajax and let php keep track for me. But, then again not all
browsers will do the Ajax either (as I understand it).
Thanks in advance
JK