SitePoint Sponsor

User Tag List

Results 1 to 2 of 2

Thread: Grrrr ... how to get the max duplicated values !?

  1. #1
    SitePoint Guru Richi's Avatar
    Join Date
    Jul 2001
    Location
    Hu,Bp.
    Posts
    842
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Angry Grrrr ... how to get the max duplicated values !?

    Hi ..

    $Array = array("a","a","b","dd","v","b","v","a");

    how can i get the max duplicated value ?

    am angry coz it`s easy and i don`t know how

    any idea ?

  2. #2
    SitePoint Guru Richi's Avatar
    Join Date
    Jul 2001
    Location
    Hu,Bp.
    Posts
    842
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    PHP Code:
        $i=-1;
        foreach (
    $Array as $Name)
        {
          ++
    $i;
          if(
    $Array[$i] == $Name)
           
    $Num[$Name]++;
        } 
    the result :
    Code:
    Array(    [a] => 3    [b] => 2
         ...etc	}
    now how to select the max ?!

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •