function drush_flatten_array

8.0.x drush.inc drush_flatten_array($a)
6.x drush.inc drush_flatten_array($a)
7.x drush.inc drush_flatten_array($a)
master drush.inc drush_flatten_array($a)

Convert a nested array into a flat array. Thows away the array keys, returning only the values.

@returns array A simple list of items (e.g. array('a','b','c')

Parameters

$args: An array that may potentially be nested. e.g. array('a', array('b', 'c'))

1 call to drush_flatten_array()

File

includes/drush.inc, line 221
The drush API implementation and helpers.

Code

function drush_flatten_array($a) {
  $result = array();
  if (!is_array($a)) {
    return array($a);
  }
  foreach ($a as $value) {
    $result = array_merge($result, drush_flatten_array($value));
  }
  return $result;
}