src/Robo/Common/ArrayManipulator.php
public static function flattenMultidimensionalArray(array $array, $glue) {
    $iterator = new \RecursiveIteratorIterator(new \RecursiveArrayIterator($array));
    $result = array();
    foreach ($iterator as $leafValue) {
      $keys = array();
      foreach (range(0, $iterator->getDepth()) as $depth) {
        $keys[] = $iterator->getSubIterator($depth)->key();
      }
      $result[implode($glue, $keys)] = $leafValue;
    }

    return $result;
  }
public static function flattenMultidimensionalArray(array $array, $glue) {
    $iterator = new \RecursiveIteratorIterator(new \RecursiveArrayIterator($array));
    $result = array();
    foreach ($iterator as $leafValue) {
      $keys = array();
      foreach (range(0, $iterator->getDepth()) as $depth) {
        $keys[] = $iterator->getSubIterator($depth)->key();
      }
      $result[implode($glue, $keys)] = $leafValue;
    }

    return $result;
  }
public static function flattenMultidimensionalArray ( array $ array , $ glue ) { $ iterator = new \ RecursiveIteratorIterator ( new \ RecursiveArrayIterator ( $ array ) ) ; $ result = array ( ) ; foreach ( $ iterator as $ leafValue ) { $ keys = array ( ) ; foreach ( range ( 0 , $ iterator -> getDepth ( ) ) as $ depth ) { $ keys [ ] = $ iterator -> getSubIterator ( $ depth ) -> key ( ) ; } $ result [ implode ( $ glue , $ keys ) ] = $ leafValue ; } return $ result ; }
Flattens a multidimensional array to a flat array, using custom glue.

This is the inverse of expandFromDotNotatedKeys(), e.g.,
['drush' => ['alias' => 'self']] would be flattened to
[drush.alias => 'self'].

@param array $array
The multidimensional array.
@param string $glue
The character(s) to use for imploding keys.

@return array
The flattened array.
Flattens a multidimensional array to a flat array using custom glue .