Answers for "same number array php"

PHP
1

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
0

php knoww if array has duplicate values

if (count($array) === count(array_unique($array))) {
		//values are unique
}
Posted by: Guest on December-17-2021

Code answers related to "same number array php"

Browse Popular Code Answers by Language