← All built-ins / array_column()
array_column()
array_column(...$args): mixed
Parameters
| Name | Type | Description |
|---|---|---|
| $rows | array | array of maps |
| $col | string | key to pick from every row |
Return value
List of the picked column values.
Example
$rows = [["n" => "a", "s" => 1], ["n" => "b", "s" => 2]];
echo implode(",", array_column($rows, "n"));a,b