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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: porton at narod dot ru
New email:
PHP Version: OS:

 

 [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

Pull Requests

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-2025 The PHP Group
All rights reserved.
Last updated: Sat May 03 06:01:27 2025 UTC