The point with this is that because i'm dealing with a multi-level structure, if I just add them in using array_push like described or just add in a new entry, then it would overwrite any examples already written. I've tried constructing the path which would end up something like:
Code: Select all
$this->spokes['Verbs']['examples']['State'][...]
//done with:
$parts=explode('.', 'Verbs.State');
$path=$this->spokes['Verbs']['examples'];
for($i=1,$b=sizeof($parts);$i<$b;$i++)
$path=$path[$parts[$i]];
$path='test';
but then changes made to that do not reflect back in the $this->spokes['Verbs']['examples'] array.
I then tried to use array_merge_recursive to stick the path back into the original array, but then you get duplicates if there is more than one example tree.
Is there any way apart from setting it up with:
Code: Select all
eval('$this->spokes["Verbs"]["examples"]["State"]=array();');
and then adding in subsequent subtrees in with the same format, where I would build the array path into a string, and then call it into eval.
Cheers,
Darkzaelus