Last active
May 26, 2016 13:52
-
-
Save itsliamjones/249d764defc6b6de3304fa6c006d23a0 to your computer and use it in GitHub Desktop.
PHP's inbuilt array_unique sucks, here's a significantly faster replacement for it
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* PHP's inbuilt array_unique sucks, here's a significantly faster replacement for it | |
* | |
* @param array $array | |
* | |
* @return array | |
*/ | |
function array_unique_fast($array) | |
{ | |
return array_keys(array_flip($array)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment