On 23-05-19 21:18, Nikita Popov wrote:
> On Thu, May 23, 2019 at 9:02 PM Dik Takken <d.tak...@xs4all.nl> wrote:
> 
>> For array_intersect(), I was actually considering to allow zero
>> arguments. The use case I have in mind is to determine the common
>> elements in a set of zero or more arrays, like this:
>>
>>     array_intersect(...$arrays)
>>
>> If that would just return an empty array when $arrays is empty, no
>> additional empty check is needed and the above would do what I
>> intuitively expect it to do.
>>
> 
> Common intuition, but not mathematically sound. Assuming we're intersecting
> subsets of a certain universe U, then the intersection of no sets is U
> itself, not the empty set. (A useful intuition is that intersecting
> additional sets can only make the result smaller -- as such intersecting no
> sets at all yields the largest possible result.)
> 
> Nikita
> 

You are completely right, thanks for pointing that out.

Regards,
Dik Takken

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

Reply via email to