> What about a signature like:
> 
> ```php
> array_first(array $array, mixed $value_if_missing = null);
> ```
> 
> That would let you specify your own sentinel (or default) where appropriate, 
> without losing the convenience of this function.

This is a problem that should be addressed in your application.

```
array_first($arr) ?? $initial
```

I personally think we should make the effort to write it this way and not have 
to support initial values ​​at the language level.

Regards.

Saki
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: https://www.php.net/unsub.php

Reply via email to