Tribe__Utils__Array::get_first_set( array $array, array $indexes, null $default = null )
Returns the value associated with the first index, among the indexes, that is set in the array.
Contents
.
Parameters
- $array
-
(array) (Required) The array to search.
- $indexes
-
(array) (Required) The indexes to search; in order the function will look from the first to the last.
- $default
-
(null) (Optional) The value that will be returned if the array does not have any of the indexes set.
Default value: null
Return
(mixed|null) The set value or the default value.
Source
File: src/Tribe/Utils/Array.php
public static function get_first_set( array $array, array $indexes, $default = null ) {
foreach ( $indexes as $index ) {
if ( ! isset( $array[ $index ] ) ) {
continue;
}
return $array[ $index ];
}
return $default;
}
Changelog
| Version | Description |
|---|---|
| 4.9.11 | Introduced. |