public static function loopEncode($data, array $parent = array())
    {
        $resultString = '';
        foreach ($data as $key => $value) {
            if (is_array($value)) {
                //subsection case
                //merge all the sections into one array...
                $sec = array_merge((array) $parent, (array) $key);
                //add section information to the output
                $resultString .= PHP_EOL . '[' . join('.', $sec) . ']' . PHP_EOL;
                //recursively traverse deeper
                $resultString .= self::loopEncode($value, $sec);
            } else {
                $resultString .= "$key = $value" . PHP_EOL;
            }
        }

        return $resultString;
    }