>> 
>> - the default is `any($iterable, fn ($value) => ...)`
>> - or `any($iterable, fn ($key) => expr, ARRAY_FILTER_USE_KEY)`
>> - or `any($iterable, fn ($value, $key) => expr, ARRAY_FILTER_USE_BOTH)`
> 
> Doesn't the occasional required use of long constant names like 
> ARRAY_FILTER_USE_KEY and ARRAY_FILTER_USE_BOTH somewhat negative the benefit 
> of a more concise syntax?  

For what it’s worth, the constants do give at least two benefits:

1. Flexibility for adding functionality without signature change.
2. Readability at the call site even if the output isn’t different in most 
cases.

example(true, true, false);

example(USE_BLUE, DROP_FIRST...

With names arguments in 8 we do get helped, I think.

mb_case_switch had 3 flags in the beginning, now gas 6 - if I’m remembering and 
interpreting the docs correctly. 

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

Reply via email to