|  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
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
Solve the problem:
35 - 21 = ?
Subscribe to this entry?

 [2021-02-13 16:17 UTC] szfjozsef at gmail dot com
From manual page:
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.


Add a Patch

Pull Requests

Add a Pull Request

PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Sat Sep 18 14:03:36 2021 UTC