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
Have you experienced this issue?
Rate the importance of this bug to you:

 [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-2020 The PHP Group
All rights reserved.
Last updated: Mon Oct 26 11:01:23 2020 UTC