Answers for "array remove duplicate values"

PHP
1

how to remove duplicate values from an array in php

<?php
$input = array("a" => "green", "red", "b" => "green", "blue", "red");
$result = array_unique($input);
print_r($result);
?>

Array
(
    [a] => green
    [0] => red
    [1] => blue
)
Posted by: Guest on January-13-2021
1

javascript filter array remove duplicates

// Using the Set constructor and the spread syntax:

arrayWithOnlyUniques = [...new Set(arrayWithDuplicates)]
Posted by: Guest on December-21-2020
0

removing duplicates from array javascript

var names = ["Mike","Matt","Nancy","Adam","Jenny","Nancy","Carl"];
var uniqueNames = [];
$.each(names, function(i, el){
    if($.inArray(el, uniqueNames) === -1) uniqueNames.push(el);
});
Posted by: Guest on November-26-2020

Code answers related to "array remove duplicate values"

Browse Popular Code Answers by Language