bp_document_multi_array_search( $array,  $search )

Description

Source

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

1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
function bp_document_multi_array_search( $array, $search ) {
 
    // Create the result array.
    $result = array();
 
    // Iterate over each array element.
    foreach ( $array as $key => $value ) {
 
        // Iterate over each search condition.
        foreach ( $search as $k => $v ) {
 
            // If the array element does not meet the search condition then continue to the next element.
            if ( ! isset( $value[ $k ] ) || $value[ $k ] != $v ) {
                continue 2;
            }
 
        }
 
        // Add the array element's key to the result array.
        $result[] = $key;
 
    }
 
    // Return the result array.
    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.