Plucks a certain field out of each object or array in an array.
Description
This has the same functionality and prototype of array_column() (PHP 5.5) but also supports objects.
Parameters
$input_listarray
List of objects or arrays.
$fieldint|string
Field from the object to place instead of the entire object.
$index_keyint|stringoptional
Field from the object to use as keys for the new array. Default null.Default: null
Return
array
Array of found values. If $index_key is set, an array of found values with keys corresponding to $index_key. If $index_key is null, array keys from the original $input_list will be preserved in the results.
Signature, return type and hooks compared across 5 parsed releases.
4.7.0
Uses WP_List_Util class.from the docblock
4.0.0
$index_key parameter added.from the docblock
3.1.0
Introduced.from the docblock
About this page
Parsed data
Generated from the wordpress-develop 6.9.7 tag, from src/wp-includes/functions.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.
Corrections
Something wrong on this page? Report it and it gets fixed in the next regeneration.