Sets the values for a single column (sub key) in a given multi-dimensional array.

Existing values in the target array are overridden.

This actually the reverse counterpart of the array_column function.


Syntax

array_set_column(array $array, string $subKey, array $values): array {


Parameter

@param array $array The target array of sub-arrays in which the column ($sbuKey) will be injected.

If this is not yet an array, an empty new array is created at first.

@param string|int|null $subKey The key (column) under which the each $values are injected.

@param array $values The 1-dimensional array containing the values to be injected.

Based on these keys (numeric / associative) the corresponding keys/elements are addressed within the target $array.



Return

Returns the enriched $array.


Examples

Yet to come...

...