src/DotArr.php
public static function convert(array $arr)
    {
        $converted = [];
        foreach ($arr as $key => $value) {
            $keys = explode('.', $key);
            $tmp =& $converted;
            foreach ($keys as $k) {
                if (!array_key_exists($k, $tmp) || !is_array($tmp[$k])) {
                    $tmp[$k] = [];
                }

                $tmp =& $tmp[$k];
            }

            $tmp = is_array($value) ? static::convert($value) : $value;
        }

        return $converted;
    }
public static function convert(array $arr)
    {
        $converted = [];
        foreach ($arr as $key => $value) {
            $keys = explode('.', $key);
            $tmp =& $converted;
            foreach ($keys as $k) {
                if (!array_key_exists($k, $tmp) || !is_array($tmp[$k])) {
                    $tmp[$k] = [];
                }

                $tmp =& $tmp[$k];
            }

            $tmp = is_array($value) ? static::convert($value) : $value;
        }

        return $converted;
    }
public static function convert ( array $ arr ) { $ converted = [ ] ; foreach ( $ arr as $ key => $ value ) { $ keys = explode ( '.' , $ key ) ; $ tmp = & $ converted ; foreach ( $ keys as $ k ) { if ( ! array_key_exists ( $ k , $ tmp ) || ! is_array ( $ tmp [ $ k ] ) ) { $ tmp [ $ k ] = [ ] ; } $ tmp = & $ tmp [ $ k ] ; } $ tmp = is_array ( $ value ) ? static :: convert ( $ value ) : $ value ; } return $ converted ; }
Converts an array to a dot-notated array.

Be aware that some values may be lost in this conversion if a partial key match is found
twice or more. The last found element of a partial key match is the one that takes precedence.

@param array $arr The array to convert.

@return array The converted array.
Converts an array to a dot - notated array .