I have an array like
$arr = [
'foo' => [
'bar' => [
1
],
'baz' => [
1
]
]
]
And another one
$path = ['foo', 'bar', 0];
I need to modify the value from $arr using $path. I need the solution to be very simple, I tried something like
$arr...$path = 2;
$arr[...$path] = 2;
After the modification $arr should look like
$arr = [
'foo' => [
'bar' => [
2
],
'baz' => [
1
]
]
]
But I got errors. I don't always know how many levels the array will have.