Req #80746 [Opn]: shuffle really should maintain key=>value relation

From: Date: Mon, 22 Nov 2021 17:58:15 +0000
Subject: Req #80746 [Opn]: shuffle really should maintain key=>value relation
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-237922@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=80746&edit=1

 ID:                 80746
 Updated by:         cmb@php.net
 Reported by:        szfjozsef at gmail dot com
 Summary:            shuffle really should maintain key=>value relation
 Status:             Open
 Type:               Feature/Change Request
 Package:            *General Issues
 Operating System:   Irrelevant
 PHP Version:        Irrelevant
 Block user comment: N
 Private report:     N

 New Comment:

> People around the world are struggling by using the shuffle()
> function.

Citation needed. :)

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

<https://www.php.net/manual/en/function.shuffle.php#94697>
does
neither look cumbersome nor long – but might be inefficient.


Previous Comments:
------------------------------------------------------------------------
[2021-02-13 16:17:10] 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.


------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=80746&edit=1


Thread (3 messages)

« previous php.bugs (#237922) next »