|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #48110 Add Freeze Array for shuffle
Submitted: 2009-04-29 16:14 UTC Modified: 2014-12-30 10:41 UTC
From: bholbrook at servillian dot com Assigned:
Status: No Feedback Package: Arrays related
PHP Version: Any OS: Irrelevant
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2009-04-29 16:14 UTC] bholbrook at servillian dot com
Add an optional parameter to the shuffle to freeze certain elements in place.

Reproduce code:
$arrShuffleMe = array(1,2,3,4,5);
shuffle($arrShuffleMe); // produces array(2,4,1,5,3);

$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.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2014-04-30 22:59 UTC]
-Status: Open +Status: Feedback -Package: Feature/Change Request +Package: Arrays related -Operating System: Any +Operating System: Irrelevant -PHP Version: 5.3.0RC1 +PHP Version: Any
 [2014-04-30 22:59 UTC]
Is this something you are still interested in seeing?
 [2014-12-30 10:41 UTC] php-bugs at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Jul 25 17:01:27 2024 UTC