Page 1 of 1

multi dimensional arrays

Posted: Sat May 01, 2010 6:08 pm
by kareem100
Hi,

I am learning PHP at a local college.

I come across the folowing code, which I have questions about

while ($row = mysqli_fetch_array($result))
{
$jokes[] = array('id' => $row['id'], 'text' => $row['joketext'];
}

I want to know

1) is jokes[] a multi-dimensional array ?

2) If it is how do you refer to the joketext of the third joke. is this answer $jokes[3,2]?

Re: multi dimensional arrays

Posted: Sat May 01, 2010 6:10 pm
by phu
1. Yes, it is a multi-dimensional array.

2. The syntax is $arr[$x][$y]. You can nest to an arbitrary depth (if you happen to think that's a good idea). ;)