Organizational Research By

Surprising Reserch Topic

dynamic array keys using -'php,arrays,multidimensional-array'


dynamic array keys  using -'php,arrays,multidimensional-array'

I have a string like this:

$string = 'one/two/three/four';

which I turn it into a array:

$keys = explode('/', $string);

This array can have any number of elements, like 1, 2, 5 etc.

How can I assign a certain value to a multidimensional array, but use the $keys I created above to identify the position where to insert?

Like:

$arr['one']['two']['three']['four'] = 'value';

Sorry if the question is confusing, but I don't know how to explain it better
    
asked Sep 7, 2015 by rajesh
0 votes
9 views



Related Hot Questions



Government Jobs Opening


...