Solution Found: Dynamic array keys
I have a multi dimensional dynamic array, the format of which varies. for example.
$data = array('blah1'=>array('blah2'=>array('hello'=>'world')));
I then have a dynamic pathway as a string.
$pathway = 'blah1/blah2/hellow';
The pathway is broken up into it's component parts, for simplicities' sake:
$pathway_parts = explode('/', $pathway);
My problem arises from wanting to set the value of 'hello'. The way I currently do it is via eval, but I want to illiminate this evil partly because of the php Suhosin hardening breaking the app, but also because I don't believe this is the best way.
eval('$data["'.implode('"]["', $pathway_parts).'"] = $value;');
$data must always return the full array because further down the array it is serialised and stored. What would the best way to transverse the array to set the value without the use of eval?