Req #48110 [Opn->Fbk]: Add Freeze Array for shuffle
| From: | levim@php.net | Date: | Wed, 30 Apr 2014 22:59:24 +0000 |
| Subject: | Req #48110 [Opn->Fbk]: Add Freeze Array for shuffle | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-185535@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=48110&edit=1
ID: 48110
Updated by: levim@php.net
Reported by: bholbrook at servillian dot com
Summary: Add Freeze Array for shuffle
-Status: Open
+Status: Feedback
Type: Feature/Change Request
-Package: Feature/Change Request
+Package: Arrays related
-Operating System: Any
+Operating System: Irrelevant
-PHP Version: 5.3.0RC1
+PHP Version: Any
Block user comment: N
Private report: N
New Comment:
Is this something you are still interested in seeing?
Previous Comments:
------------------------------------------------------------------------
[2009-04-29 16:14:08] bholbrook at servillian dot com
Description:
------------
Add an optional parameter to the shuffle to freeze certain elements in place.
Reproduce code:
---------------
//CURRENTLY
$arrShuffleMe = array(1,2,3,4,5);
shuffle($arrShuffleMe); // produces array(2,4,1,5,3);
//PROPOSED
$arrShuffleMe = array(1,2,3,4,5);
$arrFreezeKeys = array(0,4);
shuffle($arrShuffleMe, $arrFreezeKeys); // produces array(1,3,4,2,5);
$arrShuffleMe = array(1,2,3,4,5);
$arrFreezeKeys = array(0,1);
shuffle($arrShuffleMe, $arrFreezeKeys); // produces array(1,2,4,5,3);
Expected result:
----------------
The shuffle function only shuffles array values whose keys do not match the keys passed in (by
array) in the second parameter.
Actual result:
--------------
Feature request. Currently no actual result.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=48110&edit=1