note 54791 deleted from function.sort by derick
| From: | derick@php.net | Date: | Wed, 31 Aug 2005 10:42:20 +0000 |
| Subject: | note 54791 deleted from function.sort by derick | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-94514@lists.php.net to get a copy of this message | ||
Note Submitter: Carl
----
I commonly use "sort" just to recreate the keys in my arrays. I do this because I usually
don't care about the order.
However, I ran into a problem where I did need to keep the order of the array the same. Thus, I
created a small and easy function that does the job for me.
I'd thought I would share it, and I posted it here, because I suspected that many people used
sort similar to myself.
<?php
function array_reindex($array) {
$new = array();
foreach ($array as $value) array_push($new,$value);
return $new;
}
?>