src/Arr.php
public static function unflatten(array $array, $delimiter = '.')
    {
        $unflattenedArray = array();

        foreach ($array as $key => $value) {
            $keyList  = explode($delimiter, $key);
            $firstKey = array_shift($keyList);

            if (sizeof($keyList) > 0) {
                $subArray = static::unflatten(array( implode($delimiter, $keyList) => $value ), $delimiter);

                foreach ($subArray as $subArrayKey => $subArrayValue) {
                    $unflattenedArray[ $firstKey ][ $subArrayKey ] = $subArrayValue;
                }
            } else {
                $unflattenedArray[ $firstKey ] = $value;
            }
        }

        return $unflattenedArray;
    }
public static function unflatten(array $array, $delimiter = '.')
    {
        $unflattenedArray = array();

        foreach ($array as $key => $value) {
            $keyList  = explode($delimiter, $key);
            $firstKey = array_shift($keyList);

            if (sizeof($keyList) > 0) {
                $subArray = static::unflatten(array( implode($delimiter, $keyList) => $value ), $delimiter);

                foreach ($subArray as $subArrayKey => $subArrayValue) {
                    $unflattenedArray[ $firstKey ][ $subArrayKey ] = $subArrayValue;
                }
            } else {
                $unflattenedArray[ $firstKey ] = $value;
            }
        }

        return $unflattenedArray;
    }
public static function unflatten ( array $ array , $ delimiter = '.' ) { $ unflattenedArray = array ( ) ; foreach ( $ array as $ key => $ value ) { $ keyList = explode ( $ delimiter , $ key ) ; $ firstKey = array_shift ( $ keyList ) ; if ( sizeof ( $ keyList ) > 0 ) { $ subArray = static :: unflatten ( array ( implode ( $ delimiter , $ keyList ) => $ value ) , $ delimiter ) ; foreach ( $ subArray as $ subArrayKey => $ subArrayValue ) { $ unflattenedArray [ $ firstKey ] [ $ subArrayKey ] = $ subArrayValue ; } } else { $ unflattenedArray [ $ firstKey ] = $ value ; } } return $ unflattenedArray ; }
Unflattens a single stacked array back into a multidimensional array.

@param  array  $array
@param  string $delimiter
@return array
Unflattens a single stacked array back into a multidimensional array .