|
Posted by Otie on 09/28/71 11:43
I think the problem is solved.
An "unset" command was in the wrong place - in the loop I had. That was
clearing the first dimension.
-----
Otie
"Otie" <otie_nospam@adelphia.net> wrote in message
news:1-adnTgcRM2XWrrZRVn-gA@adelphia.com...
> Please help, someone.
>
> I have a multi-dimensional array called $longitude. It is 2 x 5 elements
> defined as:
>
> $longitude[0][0] = "1";
> $longitude[0][1] = "2";
> $longitude[0][2] = "3";
> $longitude[0][3] = "4";
> $longitude[0][4] = "5";
> $longitude[1][0] = "6";
> $longitude[1][1] = "7";
> $longitude[1][2] = "8";
> $longitude[1][3] = "9";
> $longitude[1][4] = "10";
>
> Why does the following function call only pass the values for the second
> element to the function - in other words, 6, 7, 8, 9, or 10?
>
> When I try to read $longitude[0][1] or anything in that first dimension, I
> get nothing.
>
>
> function call:
> $num = GetCoordinates($longitude);
>
>
> Function GetCoordinates($longitude)
> {
> $nums = 0;
>
> for ($y = 0; $y <= 4; $y++)
> {
>
> $sy = $longitude[0][$y]; //$longitude[0][$y] always reads
> nothing
>
> for ($x = 0; $x <= 4; $x++)
> {
> $sx = $longitude[1][$x] //$longitude[1][$x] always pulls the
> right value
>
> $nums++;
> }
> }
>
> return $nums;
> }
>
>
>
> Thank you.
>
>
> Otis
>
Navigation:
[Reply to this message]
|