[ create a new paste ] login | about

Link: http://codepad.org/9EJQgHhj    [ raw code | output | fork ]

PHP, pasted on Oct 20:
1
2
3
4
5
6
7
8
9
10
11
<?php

$arr = array(1=>'1233',2=>'12334',3 =>'Hello' ,4=>'HELLO', 5=>'U');

// Convert every value to uppercase, and remove duplicate values
$withoutDuplicates = array_unique(array_map("strtoupper", $arr));

// The difference in the original array, and the $withoutDuplicates array
// will be the duplicate values
$duplicates = array_diff($arr, $withoutDuplicates);
print_r($duplicates);


Output:
1
2
3
4
Array
(
    [3] => Hello
)


Create a new paste based on this one


Comments: