#lavavel — Public Fediverse posts
Live and recent posts from across the Fediverse tagged #lavavel, aggregated by home.social.
-
Fellow #PHP #webDevelopers,
PHP 8.1 introduced `array_is_list()`
This implies that `array_is_assoc()` is essentially its negation (e.g. #Lavavel therefor has the complementing methods `Arr::isList()` and `Arr::isAssoc()`).Knowing, that an array is a list, can help by narrowing the key type to `int`. However, knowing, that the array is associative, tells us less: Just that the keys are of mixed type.
So, how would you call a function that testifies that an array only has string keys?
-
Fellow #PHP #webDevelopers,
PHP 8.1 introduced `array_is_list()`
This implies that `array_is_assoc()` is essentially its negation (e.g. #Lavavel therefor has the complementing methods `Arr::isList()` and `Arr::isAssoc()`).Knowing, that an array is a list, can help by narrowing the key type to `int`. However, knowing, that the array is associative, tells us less: Just that the keys are of mixed type.
So, how would you call a function that testifies that an array only has string keys?