0

According to this link here I wrote a similar answer as in bottom. Wonder if there is more generic and compact way of writing the solution?

$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);
}
3
  • Yes there is, but readability is a million times more important than compactness. Commented Jul 12, 2013 at 16:11
  • what about when there is a compilation time to take into consideration?
    – Eric T
    Commented Jul 12, 2013 at 16:14
  • 1
    Compactness and speed of execution are unrelated. And the difference would be insignificant anyway. Commented Jul 12, 2013 at 16:16

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.