将config ini转换为字符串点分隔值到实际数组键

got a multidimensional array and a string in a config and i need to transform it as an array key without the use of eval. Real world use of this problems is that i got a big document from mongodb that is transformed into multi dimensional array. However i need to define specific array nodes from a config file.

the idea is to create a config file as representation of the array key's hierarchy

on the config.ini the values below are some example.

colorattribute = attribute.color
wholesaleprice = prices.wholesale

Example Response from mongoDb

<?php
$products = array(
                'product_name' => 'iTouch',
                'brand_name' => 'Apple',
                'attributes' => array ( 'color' => 'black',
                                        'size' => '5 in'
                                      ),
                'prices' => array(
                                    'wholesale' => 135,
                                    'retail' => 200,
                                ),
                );
 function recurseKeys(array $keys,array $array){
    $key = array_shift($keys);
    if(!isset($array[$key])) return null;
    return empty($keys) ?
      $array[$key]:
      recurseKeys($keys,$array[$key];
 }

 var_dump(recurseKeys(explode('.',$testConfig),$products);