faqts : Computers : Programming : Languages : PHP : kms : General : Arrays

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

46 of 55 people (84%) answered Yes
Recently 8 of 10 people (80%) answered Yes

Entry

How can I get the size of a row of a two dimensional array?
Can I use sizeof with multi-dimensional arrays?

May 13th, 2000 18:50
Nathan Wallace, Jason Brooke


Thats simple, when you have a multi-dimensional array, each
array-element *is* an array.  So, for a two dimensional array like this:

    $Arr[$i][$j]

then:

    sizeof($Arr[$i])

will tell you how many elements in that particular dimension of the
array.