Changing order of just one array item?
| From: | Leif K-Brooks | Date: | Sun, 19 Jan 2003 02:35:30 +0000 |
| Subject: | Changing order of just one array item? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-132155@lists.php.net to get a copy of this message | ||
I need to change where one item is ordered in an array. I know how to sory an array, but I need to move one item up/down in the array. Example:
$array is:
0 => "element one"
1 => "element two"
2 => "element three"
3 => "element four"
I call array_order_up($array[1]) and $array is now:
0 => "element one"
2 => "element three"
1 => "element two"
3 => "element four"
If there aren't any native functions to do this, can anyone think of a way to make my own function to do this?
--
The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it
will be prosecuted to the full extent of the law.