getFirstValue.php
Table of Contents
Functions
- getFirstValue() : mixed
- Returns the value of the first key from the provided list of keys that exists in the given array.
Functions
getFirstValue()
Returns the value of the first key from the provided list of keys that exists in the given array.
getFirstValue(array<string|int, mixed> $array, array<string|int, mixed> $keys[, mixed $default = null ]) : mixed
If none of the keys exist, the default value is returned.
Parameters
- $array : array<string|int, mixed>
-
The array to search within.
- $keys : array<string|int, mixed>
-
An ordered list of keys to check in the array.
- $default : mixed = null
-
The value to return if none of the keys exist in the array. Default is null.
Tags
Return values
mixed —Returns the value corresponding to the first matching key if found, otherwise returns the default value.