Answers for "a function that takes an array and returns the same array without duplicates php"

PHP
0

get duplicate value from array php

$arr = array(1, 4, 6, 1, 8, 9, 4, 6);

$unique = array_unique($arr);

$duplicates = array_diff_assoc($arr, $unique);

print_r($duplicates);
Array ( [3] => 1 [6] => 4 [7] => 6 )
Posted by: Guest on October-08-2020

Code answers related to "a function that takes an array and returns the same array without duplicates php"

Browse Popular Code Answers by Language