Download the PHP package wrossmann/array_uunique without Composer
On this page you can find all versions of the php package wrossmann/array_uunique. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Please rate this library. Is it a good library?
Informations about the package array_uunique
Userland Implementation of Missing array_uunique()
Function
There are various workarounds to get this functionality, and this is one of them!
Code
Example Usage
Output:
What is a Reductor?
The Reductor is a function to take a complex type [eg: an array or object] and reduce it to a simple type [eg: a string or an integer] so that a simple, strict comparison can be performed.
If there's a better suited name for this kind of function please let me know.
Caveats
- Filtering does not happen in-place, so there may be up to 2x memory usage from this.
- An array of unique Reductor outputs is maintained during execution, so this will also factor into memory usage.
- Consider using a hash function to reduce the size of your Reductor output.
- Assumed Complexity:
n*log(n)
- Someone on ##[email protected] said that this "looks slow" but didn't offer much in the way of explanation, so watch out for that, I guess.
:I
- This doesn't use a Comparator function.
- I wanted to rely on PHP builtins as much as possible, and while using a Comparator would make this much more flexible, I would have to re-implement elements of sorting and iteration in userland which would be less than ideal.
Why is this not part of PHP core?
TL;DR: "It looks like a typo, and would require as much work as similar functions that were already implemented."
Gimme a break.
All versions of array_uunique with dependencies
PHP Build Version
Package Version
Requires
php Version
>=5.4.0
The package wrossmann/array_uunique contains the following files
Loading the files please wait ....