Re: [PHP-DEV] sets From: Andrei Zmievski (andrei <email protected>)
Date: 05/06/00

Submit a Feature Request at bugs.php.net/version4.

On Sat, 06 May 2000, Stig Venaas wrote:
> Hi
>
> I'm writing an PHP4 application where I use sets a lot. The sets are
> arrays, but I only care what values I have in them, not about indices
> and ordering. I use the set operations union, intersection, subtraction
> a lot. I also need to check whether something is an element, that's
> easily done with array_in. I could do union with the array_merge
> function sort of, but I don't want duplicate values. It would help if
> had a function to remove duplicates though, but a specialised union
> would help.
>
>
> Would the following functions be accepted if I wrote them?
>
> array array_union(array array1, array array2)
> Creates an array that contains all values from array1 and array2 without
> any duplicates provided array1 and array2 don't have dups.
>
> array array_intersection(array array1, array array2)
> Creates an array that contains all values that exists both in array1 and
> array2.
>
> array array_subtraction(array array1, array array2)
> Creates an array that contains all values from array1 that is not in
> array2.
>
> The ordering will mostly be preserved, then they are also useful for
> "lists".
>
>
> Should they be named set_ rather than array_?
>
> So what do you say, is this useful?
>
> Stig
>
> --
> Stig Venaas
> UNINETT
>
> --
> PHP Development Mailing List <http://www.php.net/>
> To unsubscribe, e-mail: php-dev-unsubscribe <email protected>
> For additional commands, e-mail: php-dev-help <email protected>
> To contact the list administrators, e-mail: php-list-admin <email protected>
>

-Andrei

"Man, if you gotta ask you'll never know."
 - Louis Armstrong, when asked "What is jazz?"

-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: php-dev-unsubscribe <email protected>
For additional commands, e-mail: php-dev-help <email protected>
To contact the list administrators, e-mail: php-list-admin <email protected>