1
The idea is to have a function that receives a array and return the reference to an index of the same, for example:
$list = ['a', 'b', 'c', 'd', 'e'];
function ref(&list) {
return &$list[3] ?? false;
}
The use would be in a recursive function to fetch a value in its elements, to change (or not):
$list = [
'a' => ['b', 'c'],
'd' => ['e', 'f' => [
'g' => ['h', 'i']
]],
]
From that array i would like to find the content g
, then the function should return the reference to this element or false if it does not find it. With the return of the function I can manipulate this array, adding, changing or deleting items.