Connecting Tech Pros Worldwide Forums | Help | Site Map

How can I get an array -n dimension size??

John Pastrovick
Guest
 
Posts: n/a
#1: Jul 17 '05
Sort of sizeof but applied to a particular array dimension.

Similar to ASP ubound(array,dimension)

Andy Hassall
Guest
 
Posts: n/a
#2: Jul 17 '05

re: How can I get an array -n dimension size??


On 22 Apr 2004 23:27:44 -0700, pastrovic2k@hotmail.com (John Pastrovick) wrote:
[color=blue]
>Sort of sizeof but applied to a particular array dimension.
>
>Similar to ASP ubound(array,dimension)[/color]

http://php.net/array

--
Andy Hassall <andy@andyh.co.uk> / Space: disk usage analysis tool
http://www.andyh.co.uk / http://www.andyhsoftware.co.uk/space
Chung Leong
Guest
 
Posts: n/a
#3: Jul 17 '05

re: How can I get an array -n dimension size??


"John Pastrovick" <pastrovic2k@hotmail.com> wrote in message
news:a21852f1.0404222227.1b57508@posting.google.co m...[color=blue]
> Sort of sizeof but applied to a particular array dimension.
>
> Similar to ASP ubound(array,dimension)[/color]

It's hard to apply the concept to multidimensional PHP arrays, since they're
stored as tree structures. Take the following for example:

$a[0][3][5][2] = "Hello";
$a[1][3][8][8] = "World";

At the second dimension, you actually have 2 arrays, one belonging to $a[0]
and another to $a[1], both with 3 as the index. So should the result be 2 or
1? And of course, you can have gaps in your indices. At the third dimension,
there're only two elements, with indices 5 and 8.


Closed Thread