php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #80746 shuffle really should maintain key=>value relation
Submitted: 2021-02-13 16:17 UTC Modified: -
From: szfjozsef at gmail dot com Assigned:
Status: Open Package: *General Issues
PHP Version: Irrelevant OS: Irrelevant
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: szfjozsef at gmail dot com
New email:
PHP Version: OS:

 

 [2021-02-13 16:17 UTC] szfjozsef at gmail dot com
Description:
------------
---
From manual page: https://php.net/function.shuffle
---
People around the world are struggling by using the shuffle() function. There is absolutely no reason to reset the keys to 0,1,2,3 when shuffling the array.
Please make shuffle() maintain the keys.

Expected result:
----------------
call shuffle() and move on.

Actual result:
--------------
Have to write cumbersome, long, inefficient functions just to restore the key=>value associations.

Patches

Add a Patch

Pull Requests

Add a Pull Request

 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Sun Aug 01 21:01:24 2021 UTC