Small array related doubt

Discussion in 'PHP' started by afridy, Nov 24, 2012.

  1. #1
    Hai folks,

    is this a single dimensional array or two dimensional array :confused:

    $array[0]['name'] = 'John Doe';
    $array[0]['email'] = 'john@example.com';

    also can i use the count() function in above to fined the array element count?

    tx
     
    Solved! View solution.
    afridy, Nov 24, 2012 IP
  2. #2
    It is a multidimensional array because $array[0] is holding an array. If you use count() on a multidimensional array then it will return the total count of total level elements, so if you run count() on this array then it will return 1.
     
    arsalankhan, Nov 24, 2012 IP
  3. afridy

    afridy Well-Known Member

    Messages:
    810
    Likes Received:
    116
    Best Answers:
    0
    Trophy Points:
    135
    #3
    Thank you for the nice explanation!!
     
    afridy, Nov 24, 2012 IP