Skip to content

Kirby 5.0.4

A::pluck()

Plucks a single column from an array

A::pluck(array $array, string $key): array

Parameters

Name Type Default Description
$arrayrequired array no default value The source array
$keyrequired string no default value The key name of the column to extract

Return type

array

The result array with all values from that column.

Parent class

Kirby\Toolkit\A

Examples

$array[] = [
  'id' => 1,
  'username' => 'homer',
];