I need to update a specific key of an associative array thrue a function. Is it possible ?
IMPORTANT, in $PATH_TAB = &$TAB_cars['car_1']['blue'];
$TAB_cars['car_1']['blue'] can be different : $TAB_cars['car_1']['type']['light'], etc.
$TAB_cars = [
'car_1' => [
'red' => '',
'blue' => '',
'type' => [
'light' => '',
'big' => ''
]
],
'car_2' => [
'green' => '',
'brown' => ''
]
];
function UpdateArray($PATH_TAB_2) {
$PATH_TAB_2 = 'TEST 2';
}
$PATH_TAB_1 = &$TAB_cars['car_1']['blue'];
UpdateArray($PATH_TAB_1);
print_r($TAB_cars);