For Programmers: Free Programming Magazines  


Home > Archive > PHP Documentation > August 2005 > #34229 [Opn->Asn]: shuffle clobbers keys, this is not documented









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author #34229 [Opn->Asn]: shuffle clobbers keys, this is not documented
dbs@php.net

2005-08-24, 6:56 pm

ID: 34229
Updated by: dbs@php.net
Reported By: david dot tulloh at anu dot edu dot au
-Status: Open
+Status: Assigned
Bug Type: Documentation problem
PHP Version: Irrelevant
-Assigned To:
+Assigned To: dbs
New Comment:

This affects multiple sorting functions. I'll define a new entity and
try to update the affected functions accordingly.


Previous Comments:
------------------------------------------------------------------------

[2005-08-24 08:03:16] david dot tulloh at anu dot edu dot au

Description:
------------
shuffle clobbers the keys in the array, this should probably be
documented, currently it is not mentioned.

Reproduce code:
---------------
$a = array('hi'=>'a', 'fred'=>'b', 'how'=>'c', 'is'=>'d',
'wilma'=>'e');
shuffle($a);
Array
(
[0] => b
[1] => c
[2] => a
[3] => e
[4] => d
)



------------------------------------------------------------------------


--
Edit this bug report at http://bugs.php.net/?id=34229&edit=1
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com