PHP多级维数组

时间:2013-07-12 16:08:26

标签: php multidimensional-array

根据这个链接here我在底部写了一个类似的答案。想知道是否有更通用和紧凑的方式来编写解决方案?

$multi_d = array();
$read_conf = parse_ini_file($filename);
foreach( $read_conf as $keys => $value)
{
    $temp =& $multi_d;
    foreach(explode( '.', $keys) as $key)
        $temp =& $temp[$key];
    $temp = trim( $value);
}

0 个答案:

没有答案