I have a simple array and I want to use array_column but strangely it does not work using a variable as column name.
$colors = array(
array( 'RAL' => 'RAL 1000', 'RGB' => '190,189,127', 'HEX' => 'BEBD7F',
'NAME' => 'Grünbeige' ),
array( 'RAL' => 'RAL 1001', 'RGB' => '194,176,120', 'HEX' => 'C2B078',
'NAME' => 'Beige' ),
);
$column_name = 'hex'; // this comes actually via $_GET['hex'];
This does not work:
print_r(array_column($colors, ucwords($column_name)));
This does work:
print_r(array_column($colors, 'HEX'));
$column_namevs$colum_name,array_collumnsvs.array_column) corrected. 3v4l.org/B7qaTarray_collumnis not the nativearray_columnfunction can you please add that definition? 3v4l.org/EuOfb