php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #65098 A modified version of array_combine()
Submitted: 2013-06-22 17:54 UTC Modified: 2018-03-12 15:16 UTC
From: porton at narod dot ru Assigned:
Status: Suspended Package: Arrays related
PHP Version: 5.5.0 OS:
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:
MUST BE VALID
Solve the problem:
34 + 3 = ?
Subscribe to this entry?

 
 [2013-06-22 17:54 UTC] porton at narod dot ru
Description:
------------
array_combine() does not behave well in the case if a key is met more than once.

I propose to add new function array_combine_array(array $keys, array $values) which will create a map from keys to arrays, each of these arrays being the list of values corresponding to this key. (If a key is met once, the array associated with this key could be on-element.)

The order of the array corresponding to a key should be agreed with the order of the original array "$values".

This can be easily implemented in PHP, but it's better to have array_combine_array() in the standard PHP library.


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2018-03-12 15:16 UTC] cmb@php.net
-Status: Open +Status: Suspended
 [2018-03-12 15:16 UTC] cmb@php.net
That appears to be controversial (at least I don't see a good
reason to add array_combine_array()), so it would require the RFC
process[1].  Anybody is welcome to start it!  For the time being,
I'm suspending this ticket.

[1] <https://wiki.php.net/rfc/howto>
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 18 04:01:27 2024 UTC