Returns unique values from an array.

Note: ugly code is ugly, but efficient: http://jsperf.com/array-unique2/8

@param  Array  array
@return Array
421600
function unique(array) {
    "use strict";
    var o = {},
        r = [];
    for (var i = 0, len = array.length; i !== len; i++) {
        var d = array[i];
        if (typeof o[d] === "undefined") {
            o[d] = 1;
            r[r.length] = d;
        }
    }
    return r;
}
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;
}
33781
function ( src )
	{
		// A faster unique method is to use object keys to identify used values,
		// but this doesn't work with arrays or objects, which we must also
		// consider. See jsperf.com/compare-array-unique-versions/4 for more
		// information.
		var
			out = [],
			val,
			i, ien=src.length,
			j, k=0;
	
		again: for ( i=0 ; i<ien ; i++ ) {
			val = src[i];
	
			for ( j=0 ; j<k ; j++ ) {
				if ( out[j] === val ) {
					continue again;
				}
			}
	
			out.push( val );
			k++;
		}
	
		return out;
	}
872903
public long[] toPrimitiveArray(long[] array) {
	for (int i = 0, j = 0; i < array.length; ++i) {
	    int index = -1;
	    if (j < indices.length && (index = indices[j]) == i) {
		array[i] = values[j];
		j++;
	    }
	    else
		array[i] = 0;
	}

	return array;
    }
220381
function unique(arr) {
    return arr.filter(function (value, idx, self) {
        return self.indexOf(value) === idx;
    });
}
61286
public static function distinct($val): bool
    {
        if (!$val || !\is_array($val)) {
            return false;
        }

        return \array_unique($val) === $val;
    }
195324
public static function unique($array)
    {
        $unique = array();
        foreach ($array as $item) {
            if (!in_array($item, $unique, true)) {
                $unique[] = $item;
            }
        }

        return $unique;
    }
730598
protected function filterDuplicatesFromArray(array $values)
    {
        $uniqueItems = [];
        foreach ($values as $value) {
            $uniqueItems[md5(serialize($value))] = $value;
        }
        $result = array_values($uniqueItems);
        if (count($result) === 1) {
            return $result[0];
        }
        return $result;
    }
413716
public static function arrayUnique($myArray)
	{
		if (!is_array($myArray))
		{
			return $myArray;
		}

		foreach ($myArray as &$myvalue)
		{
			$myvalue = serialize($myvalue);
		}

		$myArray = array_unique($myArray);

		foreach ($myArray as &$myvalue)
		{
			$myvalue = unserialize($myvalue);
		}

		return $myArray;
	}
1026226
def get_not_unique_values(array):
    '''
    '''
    s = np.sort(array, axis=None)
    s = s[s[1:] == s[:-1]]
    return np.unique(s)
252711
public function unique(array $arr1, array $arr2)
    {
        Deprecated::method(3.2);

        $merged = array_unique(array_merge($arr1, $arr2), SORT_REGULAR);
        $compiled = [];

        foreach ($merged as $key => $val) {
            if (is_array($val) && array_values($val) === $val) {
                $compiled[$key] = $val;
            } else {
                $compiled[$val] = $val;
            }
        }

        return $compiled;
    }
369123
private function serializeArrayRecursively(array $array): array
    {
        $data = [];
        foreach ($array as $key => $value) {
            $data[$key] = $this->serializeValue($value);
        }

        return $data;
    }
1137041
public static function cloneArray(array $array): array
    {
        $newArray = [];
        foreach($array as $key => $value) {
            if(\is_object($value)) {
                $newArray[$key] = clone $value;
            } elseif(\is_array($value)) {
                $newArray[$key] = self::cloneArray($value);
            } else {
                $newArray[$key] = $value;
            }
        }
        return $newArray;
    }
185521
public static function array_unique_keys($array)
    {
        $arrResult = [];

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

        return $arrResult;
    }
1367879
private static function getValueList(array $array): array
    {
        foreach ($array as $i => $attr)
            $array[$i] = (is_array($attr) ? self::getValueList($attr) : self::getValue($attr));

        return $array;
    }
965015
public function getColumns()
    {
        $columns = array();
        foreach ($this->getRows() as $row) {
            $columns = array_merge($columns, $row->getColumns());
        }
        return array_unique($columns);
    }
1092950
public static function arrayMergeRecursiveUnique($array1, $array2)
    {
        if (empty($array1)) {
            // Optimize the base case
            return $array2;
        }

        foreach ($array2 as $key => $value) {
            if (is_array($value) && isset($array1[$key]) && is_array($array1[$key])) {
                $value = static::arrayMergeRecursiveUnique($array1[$key], $value);
            }
            $array1[$key] = $value;
        }

        return $array1;
    }