php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #34526 array-related operation to "reduce" contained items
Submitted: 2005-09-16 14:01 UTC Modified: 2013-03-15 14:53 UTC
From: soletan at toxa dot de Assigned:
Status: Duplicate Package: *General Issues
PHP Version: 5.0.5 OS: Linux
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: soletan at toxa dot de
New email:
PHP Version: OS:

 

 [2005-09-16 14:01 UTC] soletan at toxa dot de
Description:
------------
Is it possible to have an array_xxxx-method to perform the transformation on arrays as given below. Since I am working with DBs and wrapping records of tables using classes I often
get the case to receive an array as given below and require
to pass the list of IDs, only.

For sure I can do the transformation all by myself in PHP using foreach. But since my software is getting more and more complex I appreciate any chance to increase my scripts' performance by having such trivial tasks being done in one step.


Reproduce code:
---------------
before:
array(
    array( 'id' => 1, 'foo' => 'bar' ),
    array( 'id' => 2, 'foo' => 'bar' ),
    array( 'id' => 3, 'foo' => 'bar' ),
    array( 'id' => 4, 'foo' => 'bar' ),
    array( 'id' => 5, 'foo' => 'bar' )
);

action:
$out = array_xxxxx( $in, 'id' );

result:
array( 1, 2, 3, 4, 5 );



Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2013-03-15 14:53 UTC] nikic@php.net
-Status: Open +Status: Duplicate -Package: Feature/Change Request +Package: *General Issues
 [2013-03-15 14:53 UTC] nikic@php.net
Duplicate of https://bugs.php.net/bug.php?id=26338.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Dec 22 06:01:30 2024 UTC