I have a multidimensional associative array. Input to my program is a string that is compose of keys from the array separated by brackets. How can I target the array and update a value?
Input
$array = Array
(
[store_name] => Jota
[social] => Array
(
[fb] => foo
)
)
$pattern = "[social][fb];"
$value = "bar";
Desired Output
$array = Array
(
[store_name] => Jota
[social] => Array
(
[fb] => bar
)
)
I tried few attempts by using regex & variable reference but nothing is likely to be pasted here. You can say I am unable to think of an Idea to achieve this :(