Skip to content

Instantly share code, notes, and snippets.

@itsliamjones
Last active May 26, 2016 13:52
Show Gist options
  • Save itsliamjones/249d764defc6b6de3304fa6c006d23a0 to your computer and use it in GitHub Desktop.
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
<?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