Jump to content

[SOLVED] Find duplicate array values


rosenrosen

Recommended Posts

Actually, thinking about it, might need some adjusting.

 

<?php

  function get_unique($arr) {
    $ret = array();
    $counted = array_count_values($arr);
    foreach ($counted as $k => $v) {
      if ($v > 1) {
        if (!in_array($k,$ret)) {
          $ret[] = $k;
        }
      }
    }
    return $ret;
  }

?>

 

Still not tested.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.