ap_search_array( array $arr, string $key, mixed $value )
Description #
Search array by key and value.
Parameters #
- $arrarray (Required) Array to search.
- $keystring (Required) Array key to search.
- $valuemixed (Required) Value of key supplied.
Source #
File: includes/functions.php
function ap_search_array( $arr, $key, $value ) { $results = array(); if ( is_array( $arr ) ) { if ( isset( $arr[ $key ] ) && $arr[ $key ] == $value ) { // phpcs:ignore Universal.Operators.StrictComparisons.LooseEqual $results[] = $arr; } foreach ( $arr as $subarray ) { $results = array_merge( $results, ap_search_array( $subarray, $key, $value ) ); } } return $results; }
Expand full source code Collapse full source code View on GitHub: includes/functions.php:1578
Add your comment