I have the following array:

```
$conf = array(
'db'    => array(
    'server'    =>  'localhost',
    'user'      =>  'root',
    'pass'      =>  'root',
    'name'      =>  'db',
    ),
'path'  =>  array(
    'site_url'  =>  $_SERVER['SERVER_NAME'],
    'site_dir'  => CMS,
    'admin_url' => conf('path.site_url') . '/admin',
    'admin_dir' => conf('path.site_dir') . DS .'admin',
    'admin_paths' => array(
                'assets' => 'path'
                ),
    ),
);

```

I would like to get a value from this array using a function like so:

```
/**
 * Return or set a configuration setting from the array.
 * @example
 * conf('db.server')    => $conf['db']['server']
 *
 * @param  string $section the section to return the setting from.
 * @param  string $setting the setting name to return.
 * @return mixed           the value of the setting returned.
 */
function conf($path, $value = null) {
    global $conf;
    // We split each word seperated by a dot character
    $paths = explode('.', $path);

    return $conf[$paths[0]][$paths[1]];
}

```

But i would like it if the function resolves all dimensions of the array and not just the first two.

Like this

```
conf('path.admin_paths.assets'); 

```

would resolve to 

```
=> $conf['path']['admin_paths']['assets']

```

How would i do this? Also, how would i make this function if it has another param, would set a value rather than return it?