Function array_first
Return the first element in an array which passes a given truth test.
// Return the first array element that equals "Taylor" $value = array_first($array, function($k, $v) {return $v == 'Taylor';}); // Return a default value if no matching element is found $value = array_first($array, function($k, $v) {return $v == 'Taylor'}, 'Default');
Located at laravel/helpers.php
array |
$array |
|
|
$callback |
|
mixed |
$default = null |
mixed
|