This question already has an answer here:
I'm trying to figure out how to take a string, parse it, and get the corresponding array values that match the parsed keys back. I don't know how to properly explain this, so here's an example.
$testArray = array(
'router' => array(
'format' => 'xml',
),
);
The string I want to parse will look like this - router.format
, and I'm obviously expecting back xml
as a string. The passed in string can have any arbitrary amount of separating periods. I was thinking of doing recursion somehow, but I can't think of any way in which this will work.
This is very similar to SF2's service container and the way in which you get services back.
Any help would be great!
</div>