You are here

function swftools_array_flatten in SWF Tools 6.3

Flatten an array which has sub-arrays in to a single keyed array.

If keys in the sub-array are the same as ones seen previously the early key will be over-written.

Parameters

array $array: Array to be processed.

Return value

nothing Manipulate the array directly.

4 calls to swftools_array_flatten()
_swftools_imagerotator_flashvars in imagerotator/swftools_imagerotator.module
This function is called from swftools_imagerotator_swftools_flashvars() which is called from swf() It will return the default flashvar configuration, just prior to any overrides passed into swf(). We start with the settings defined on…
_swftools_jw5_flashvars in jw5/swftools_jw5.module
Return the default flashvar configuration for JW Player 4.
_swftools_wijering4_flashvars in wijering4/swftools_wijering4.module
Return the default flashvar configuration for JW Player 4.
_swftools_wpaudio_flashvars in wpaudio/swftools_wpaudio.module
Retrieves the audio player default settings and unsets any that are empty.

File

./swftools.module, line 1623
The primary component of SWF Tools that enables comprehensive media handling.

Code

function swftools_array_flatten(&$array) {

  // Only process if we passed an array
  if (is_array($array)) {

    // Iterate over the array
    foreach ($array as $key => $value) {

      // If the value is in itself an array then flatten that too
      if (is_array($value)) {

        // Unset this key as this contains an array
        unset($array[$key]);

        // Flatten the sub-array
        swftools_array_flatten($value);

        // Merge the flattened sub-array in to the rest of the array
        $array = array_merge($array, $value);
      }
    }
  }
}