From: bholbrook at servillian dot com Operating system: Any PHP version: 5.3.0RC1 PHP Bug Type: Feature/Change Request Bug description: Add Freeze Array for shuffle
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 bug report at http://bugs.php.net/?id=48110&edit=1 -- Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=48110&r=trysnapshot52 Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=48110&r=trysnapshot53 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=48110&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=48110&r=fixedcvs Fixed in CVS and need be documented: http://bugs.php.net/fix.php?id=48110&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=48110&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=48110&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=48110&r=needscript Try newer version: http://bugs.php.net/fix.php?id=48110&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=48110&r=support Expected behavior: http://bugs.php.net/fix.php?id=48110&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=48110&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=48110&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=48110&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=48110&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=48110&r=dst IIS Stability: http://bugs.php.net/fix.php?id=48110&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=48110&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=48110&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=48110&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=48110&r=mysqlcfg