I have an multidimensional associative array as follows
$data = Array
(
[store_name] => Jota
[social] => Array
(
[fb] => 78
[youtube] => 34
[twitter] => 97
[linkedin] => 23
[pinterest] => 12
[instagram] => 93
[flickr] => 45
)
)
Input to my program is a string that is compose of keys from the above array separated by brackets. E.g
$input = "data[social][fb]"
Question 1
How can I traverse the above array as per the input string pattern & access the value of $data["social"]["fb"]
?
Question 2
How can I update the value in the above array followed by a string pattern?
$pattern = "data[social][fb];
$value = "foo";
update_array( $data, $pattern, $value);