Uniques an array by key, not by value
185521
public static function array_unique_keys($array)
    {
        $arrResult = [];

        foreach (array_unique(array_keys($array)) as $varKey)
        {
            $arrResult[$varKey] = $array[$varKey];
        }

        return $arrResult;
    }
791301
function uniqueArray(item) {
  const u = {};
  const newArray = [];
  for (let i = 0, l = item.length; i < l; ++i) {
    if (!{}.hasOwnProperty.call(u, item[i])) {
      newArray.push(item[i]);
      u[item[i]] = 1;
    }
  }
  return newArray;
}
120832
def unique(values):
    '''
    
    '''
    ret = None
    if isinstance(values, collections.Hashable):
        ret = set(values)
    else:
        ret = []
        for value in values:
            if value not in ret:
                ret.append(value)
    return ret
683405
function array_merge_recursive_unique($array1, $array2)
	{
		$arrays = func_get_args();
		$narrays = count($arrays);
		$ret = $arrays[0];
		for ($i = 1; $i < $narrays; $i ++) {
			foreach ($arrays[$i] as $key => $value) {
				if (((string) $key) === ((string)((int) $key))) { // integer or string as integer key - append
					$ret[] = $value;
				} else { // string key - merge
					if (is_array($value) && isset($ret[$key])) {
						$ret[$key] = $this->array_merge_recursive_unique($ret[$key], $value);
					} else {
						$ret[$key] = $value;
					}
				}
			}
		}
		return $ret;
	}
1172799
function uniqueCountLegacy(arr) {
  const seen = [];
  arr.forEach((item) => {
    if (seen.indexOf(item) === -1) {
      seen.push(item);
    }
  });
  return seen.length;
}
170905
public function unique($key = null, $strict = false)
    {
        $callback = $this->valueRetriever($key);

        $exists = [];

        return $this->reject(function ($item, $key) use ($callback, $strict, &$exists) {
            if (in_array($id = $callback($item, $key), $exists, $strict)) {
                return true;
            }

            $exists[] = $id;
        });
    }
1248096
def unique_list(input_, key=lambda x:x):
    """"""
    seen = set()
    output = []
    for x in input_:
        keyx = key(x)
        if keyx not in seen:
            seen.add(keyx)
            output.append(x)
    return output
220381
function unique(arr) {
    return arr.filter(function (value, idx, self) {
        return self.indexOf(value) === idx;
    });
}
1259126
function unique(arr) {
  var ret = [];

  for (var i = 0; i < arr.length; i++) {
    if (~ret.indexOf(arr[i])) continue;
    ret.push(arr[i]);
  }

  return ret;
}
281880
function it_should_be_unique(){
        $ids = [];
        $iterations = 100;

        for($i=0; $i < $iterations; $i++){
            $ids[] = $this->getWrappedObject()->generate();
        }

        return (count(array_values($ids)) === $iterations);
    }
938526
function uniqueize(a) {
  return a.filter((elt, i) => a.indexOf(elt) === i);
}
707390
def remove_duplicates_from_list(array):
    ""
    output = []
    unique = set()
    for a in array:
        if a not in unique:
            unique.add(a)
            output.append(a)
    return output
839817
function ( object ) {
      this.__class__ = 'Unique';

      if ( 'object' === typeof object )
        this.key = object.key;

      this.validate = function ( array ) {
        var value, store = [];

        if ( !_isArray( array ) )
          throw new Violation( this, array, { value: Validator.errorCode.must_be_an_array } );

        for ( var i = 0; i < array.length; i++ ) {
          value = 'object' === typeof array[ i ] ? array[ i ][ this.key ] : array[ i ];

          if ( 'undefined' === typeof value )
            continue;

          if ( -1 !== store.indexOf( value ) )
            throw new Violation( this, array, { value: value } );

          store.push( value );
        }

        return true;
      };

      return this;
    }
36740
public static function array_merge_recursive_unique($array1, $array2)
    {
        // LOOP THROUGH $array2
        foreach ($array2 as $k => $v) {

            // CHECK IF VALUE EXISTS IN $array1
            if (!empty($array1[$k])) {
                // IF VALUE EXISTS CHECK IF IT'S AN ARRAY OR A STRING
                if (!is_array($array2[$k])) {
                    // OVERWRITE IF IT'S A STRING
                    $array1[$k]=$array2[$k];
                } else {
                    // RECURSE IF IT'S AN ARRAY
                    $array1[$k] = self::array_merge_recursive_unique($array1[$k], $array2[$k]);
                }
            } else {
                // IF VALUE DOESN'T EXIST IN $array1 USE $array2 VALUE
                $array1[$k]=$v;
            }
        }
        unset($k, $v);

        return $array1;
    }
684627
function uniqueValues(categorical) {
  const countMap = {};
  categorical.forEach((val) => {
    if (!(val in countMap)) {
      countMap[val] = 0;
    }
    countMap[val] += 1;
  });
  const uniques = [];
  const counts = [];
  Object.keys(countMap).forEach((uniqueVal) => {
    uniques.push(uniqueVal);
    counts.push(countMap[uniqueVal]);
  });
  return [uniques, counts];
}
1124419
private function unique($var)
	{
		if (is_array($var))
		{
			// We only want to get unique items if they aren't associative
			if (isset($var[0]))
			{
				// Serialize vars, unique them, then unserialize
				$var = array_map('unserialize', array_unique(array_map('serialize', $var)));
			}

			foreach ($var as &$sub)
			{
				if (is_array($sub))
				{
					$sub = $this->unique($sub);
				}
			}
		}

		return $var;
	}
725454
function unique(array) {
    array.sort();

    var i, item, lastItem;

    for (i = array.length - 1; i >= 0; i--) {
        item = array[i];
        if (item == lastItem) {
            array.splice(i, 1);
        } else {
            lastItem = item;
        }
    }

    return array;
}