Guest User

Untitled

a guest
Nov 24th, 2017
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. function contar($array)
  2. {
  3. $repetidos = 0;
  4. $ya_duplicados = array();
  5. foreach($array as $item)
  6. {
  7. for($u=0;$u<sizeof($array); $u++)
  8. {
  9. if($item == $array[$u] && !in_array($item, $ya_duplicados))
  10. {
  11. ++$cont;
  12. }
  13. }
  14.  
  15. if($cont >= 2)
  16. {
  17. array_push($ya_duplicados, $item);
  18. $repetidos++;
  19. }
  20.  
  21. $cont = 0;
  22. }
  23. return $repetidos;
  24. }
Add Comment
Please, Sign In to add comment