multidimensional arrays
| From: | Michael Kimsal | Date: | Tue, 17 Apr 2001 20:20:03 +0000 |
| Subject: | multidimensional arrays | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-49040@lists.php.net to get a copy of this message | ||
Plutarck wrote:
> PHP can be a tad screwy with how it handles multi-dimensional arrays, but
> yes PHP handles them. No real speed problems with them either.
>
> But you may just want to use an associative array like:
>
> $loc = array("y" => $y, "x" => $x);
>
> Then just use $loc["y"] and $loc["x"].
>
> Just another option, but feel free to use multi-dimensional arrays. Just be
> aware that PHP supports only two dimensions (so $array[][][] will not work),
> and if you try and get fancy with sort() and count() you are going to give
> yourself a migraine.
$a[1][2][3][4][5] = "6";
echo $a[1][2][3][4][5];
$b[][][][]= "7";
echo $b[0][0][0][0];
I get '6' and '7'. Am I doing something wrong? This seems like PHP supports
arrays with
dimensions greater than 2.