function transformArray($array, $key)
{
$transformed = [];
foreach ($array as $k => $value) {
$transformed[] = $value[$key]
}
return $transformed;
}
$array = [
0 => [
'key' => 1,
'key2' => 2
]
];
transformArray($array, 'key2');
Often I need function to build array from multidimesions array, for that I'm write function like in example, some frameworks have own function to do this, maybe for this solution exist shortest way with standart PHP
functions ?