note 130523 added to function.array-column
| From: | aschmidt@anamera.net | Date: | Sat, 18 Oct 2025 22:20:56 +0000 |
| Subject: | note 130523 added to function.array-column | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-222389@lists.php.net to get a copy of this message | ||
Unfortunately, the most "basic" index functionality has been overlooked: indexing the
resulting array using the original index -- in other words, simply maintaining the original index
and associating that with a chosen column from the array.
Consequently, one has to suffer additional overhead by resorting to some workaround, e.g.:
array_combine( array_keys( $array ), array_column( $array, 'some column' ) );
----
Server IP: 45.112.84.4
Probable Submitter: 45.112.84.18 (proxied: 108.58.160.146)
----
Manual Page -- https://php.net/manual/en/function.array-column.php
Edit -- https://main.php.net/note/edit/130523
Del: integrated -- https://main.php.net/note/delete/130523/integrated
Del: useless -- https://main.php.net/note/delete/130523/useless
Del: bad code -- https://main.php.net/note/delete/130523/bad+code
Del: spam -- https://main.php.net/note/delete/130523/spam
Del: non-english -- https://main.php.net/note/delete/130523/non-english
Del: in docs -- https://main.php.net/note/delete/130523/in+docs
Del: other reasons-- https://main.php.net/note/delete/130523
Reject -- https://main.php.net/note/reject/130523
Search -- https://main.php.net/manage/user-notes.php