using patterns

Discussion in 'PHP' started by alarik, Dec 13, 2006.

  1. #1
    so,I have a pattern and using Preg_match_all I get my matches into the variable $matches[$x][$y].I want to know how many matches I have,how do I do that?how do I number the matches of my pattern?
     
    alarik, Dec 13, 2006 IP
  2. krakjoe

    krakjoe Well-Known Member

    Messages:
    1,795
    Likes Received:
    141
    Best Answers:
    0
    Trophy Points:
    135
    #2
    count($matches["dim"]); where dim is the dimension of the array your counting
     
    krakjoe, Dec 13, 2006 IP
  3. alarik

    alarik Active Member

    Messages:
    382
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    58
    #3
    and how do I get the dimension?
     
    alarik, Dec 13, 2006 IP
  4. Barti1987

    Barti1987 Well-Known Member

    Messages:
    2,703
    Likes Received:
    115
    Best Answers:
    0
    Trophy Points:
    185
    #4
    
    
    $array[3][4][] = 'sdsdfsd';
    $array[3][4][] = 'sdsdfsd';
    $array[3][4][] = 'sdsdfsd';
    
    echo count($array[3][4]);
    //Will print "3";
    
    
    PHP:
    Peace,
     
    Barti1987, Dec 13, 2006 IP