public static function flattenIntoDots(array $subjectArray, $keyPrefix = '')
    {
        $flattenArray = [];

        foreach ($subjectArray as $key => $value) {
            $newKey = $keyPrefix . $key;

            if (is_array($value) && !empty($value)) {
                $flattenArray = array_merge($flattenArray, self::flattenIntoDots($value, $newKey . '.'));
                continue;
            }
            $flattenArray[$newKey] = $value;
        }

        return $flattenArray;
    }
public static function flattenIntoDots(array $subjectArray, $keyPrefix = '')
    {
        $flattenArray = [];

        foreach ($subjectArray as $key => $value) {
            $newKey = $keyPrefix . $key;

            if (is_array($value) && !empty($value)) {
                $flattenArray = array_merge($flattenArray, self::flattenIntoDots($value, $newKey . '.'));
                continue;
            }
            $flattenArray[$newKey] = $value;
        }

        return $flattenArray;
    }
public static function flattenIntoDots ( array $ subjectArray , $ keyPrefix = '' ) { $ flattenArray = [ ] ; foreach ( $ subjectArray as $ key => $ value ) { $ newKey = $ keyPrefix . $ key ; if ( is_array ( $ value ) && ! empty ( $ value ) ) { $ flattenArray = array_merge ( $ flattenArray , self :: flattenIntoDots ( $ value , $ newKey . '.' ) ) ; continue ; } $ flattenArray [ $ newKey ] = $ value ; } return $ flattenArray ; }
Flatten a multi-dimensional array into a single level with the keys compressed
into dot notation to indicate each depth level.

If a prefix is passed into the method, it is appended to each key.

@since 3.0.0

@param array $subjectArray The subject array to work on
@param string $keyPrefix (Optional) prefix to prepend to the keys

@return array
Flatten a multi - dimensional array into a single level with the keys compressed into dot notation to indicate each depth level .