#7354 [Opn->Csd]: Feature Request: sort on single element arrays
| From: | sniper@php.net | Date: | Thu, 14 Aug 2003 07:09:04 +0000 |
| Subject: | #7354 [Opn->Csd]: Feature Request: sort on single element arrays | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-45919@lists.php.net to get a copy of this message | ||
ID: 7354
Updated by: sniper@php.net
Reported By: charlie at screaming-penguin dot com
-Status: Open
+Status: Closed
Bug Type: Feature/Change Request
Operating System: Linux 2.2.x
PHP Version: 4.0.3pl1
New Comment:
I don't know when this has been fixed but in latest
stable CVS this works as you expect. (single element array key is reset
with sort())
Previous Comments:
------------------------------------------------------------------------
[2000-10-19 18:23:47] charlie at screaming-penguin dot com
sort() does not appear to work for arrays that have only a single
element. I am using dynamically built arrays and when an array happens
to have a single element it does not get touched by sort.
This makes sense as far as Why would I want to sort an array with a
single element? Because I want the indeces reset, not just the values
sorted. If an array has this structure:
array(1) { [3]=> string(9) "Baltimore"
then it will not be touched at all by sort and will not be re-indexed
to start at 0.
It would be nice if sort would sort single element arrays.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=7354&edit=1