bp_array_flatten( $array )

Description

Source

File: bp-core/bp-core-functions.php

4704
4705
4706
4707
4708
4709
4710
4711
4712
4713
4714
4715
4716
4717
function bp_array_flatten( $array ) {
    if ( ! is_array( $array ) ) {
        return false;
    }
    $result = array();
    foreach ( $array as $key => $value ) {
        if ( is_array( $value ) ) {
            $result = array_merge( $result, bp_array_flatten( $value ) );
        } else {
            $result[ $key ] = $value;
        }
    }
    return $result;
}

Questions?

We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.