Req #34526 [Opn->Dup]: array-related operation to "reduce" contained items
| From: | nikic@php.net | Date: | Fri, 15 Mar 2013 14:53:04 +0000 |
| Subject: | Req #34526 [Opn->Dup]: array-related operation to "reduce" contained items | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-177807@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=34526&edit=1
ID: 34526
Updated by: nikic@php.net
Reported by: soletan at toxa dot de
Summary: array-related operation to "reduce" contained items
-Status: Open
+Status: Duplicate
Type: Feature/Change Request
-Package: Feature/Change Request
+Package: *General Issues
Operating System: Linux
PHP Version: 5.0.5
Block user comment: N
Private report: N
New Comment:
Duplicate of https://bugs.php.net/bug.php?id=26338.
Previous Comments:
------------------------------------------------------------------------
[2005-09-16 14:01:14] 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 );
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=34526&edit=1