I have a string var that get’s built with a string something like:
$selection = "[selection1][selection2]";
selection1 and selection2 can really be any word. And there can be more selections in the var such as “[selection1][selection2][selection3][selection4]”
Is there anyway to use this to define a dynamic array key path so it can be used to assign values to an array? Something like:
1) Extract elements (preg_match_all).
2) You now know how many layers deep you're going, and the keys for each level.
3.a) $target = 'some_arr';
3) Foreach key in the array of keys:
4) If ${$target}[$key] Does Not Exist, ${$target}[$key] = array();
5) $target += "['".$key."']";
6) EndForeach