public static function expand(array $data, array $options = []) {
		$defaults = ['separator' => '.'];
		$options += $defaults;
		$result = [];

		foreach ($data as $key => $val) {
			if (strpos($key, $options['separator']) === false) {
				if (!isset($result[$key])) {
					$result[$key] = $val;
				}
				continue;
			}
			list($path, $key) = explode($options['separator'], $key, 2);
			$path = is_numeric($path) ? (integer) $path : $path;
			$result[$path][$key] = $val;
		}
		foreach ($result as $key => $value) {
			if (is_array($value)) {
				$result[$key] = static::expand($value, $options);
			}
		}
		return $result;
	}
public static function expand(array $data, array $options = []) {
		$defaults = ['separator' => '.'];
		$options += $defaults;
		$result = [];

		foreach ($data as $key => $val) {
			if (strpos($key, $options['separator']) === false) {
				if (!isset($result[$key])) {
					$result[$key] = $val;
				}
				continue;
			}
			list($path, $key) = explode($options['separator'], $key, 2);
			$path = is_numeric($path) ? (integer) $path : $path;
			$result[$path][$key] = $val;
		}
		foreach ($result as $key => $value) {
			if (is_array($value)) {
				$result[$key] = static::expand($value, $options);
			}
		}
		return $result;
	}
public static function expand ( array $ data , array $ options = [ ] ) { $ defaults = [ 'separator' => '.' ] ; $ options += $ defaults ; $ result = [ ] ; foreach ( $ data as $ key => $ val ) { if ( strpos ( $ key , $ options [ 'separator' ] ) === false ) { if ( ! isset ( $ result [ $ key ] ) ) { $ result [ $ key ] = $ val ; } continue ; } list ( $ path , $ key ) = explode ( $ options [ 'separator' ] , $ key , 2 ) ; $ path = is_numeric ( $ path ) ? ( integer ) $ path : $ path ; $ result [ $ path ] [ $ key ] = $ val ; } foreach ( $ result as $ key => $ value ) { if ( is_array ( $ value ) ) { $ result [ $ key ] = static :: expand ( $ value , $ options ) ; } } return $ result ; }
Accepts a one-dimensional array where the keys are separated by a delimiter.

@param array $data The one-dimensional array to expand.
@param array $options The options used when expanding the array:
- `'separator'` _string_: The delimiter to use when separating keys. Defaults
to `'.'`.
@return array Returns a multi-dimensional array expanded from a one dimensional
dot-separated array.
Accepts a one - dimensional array where the keys are separated by a delimiter .