fork(13) download
  1. <?php
  2.  
  3. $courses = array('teste', 'teste2', 'testexyz','teste3', 'teste', 'testexyz');
  4. function get_duplicates( $array ) {
  5. return array_unique( array_diff_assoc( $array, array_unique( $array ) ) );
  6. }
  7. $list = get_duplicates($courses);
  8.  
  9. print_r($list);
Success #stdin #stdout 0s 52488KB
stdin
Standard input is empty
stdout
Array
(
    [4] => teste
    [5] => testexyz
)