note 8740 added to array

From: Date: Tue, 26 Sep 2000 15:07:08 +0000
Subject: note 8740 added to array
Groups: php.notes 
Request: Send a blank email to php-notes+get-5431@lists.php.net to get a copy of this message
Multidimensional arrays are actually single-dimensional arrays nested inside other single-dimensional arrays. $array[0] refers to element 0 of $array $array[0][2] refers to element 2 of element 0 of $array. If an array was initialized like this: $array[0] = "foo"; $array[1][0] = "bar"; $array[1][1] = "baz"; $array[1][2] = "bam"; then: is_array($array) = TRUE is_array($array[0]) = FALSE is_array($array[1]) = TRUE count($array) = 2 (elements 0 and 1) count($array[1] = 3 (elements 0 thru 2) This can be really useful if you want to return a list of arrays that were stored in a file or something: $array[0] = unserialize($somedata); $array[1] = unserialize($someotherdata); if $somedata["foo"] = 42 before it was serialized previously, you'd now have this: $array[0]["foo"] = 42 http://www.php.net/manual/function.array.php

« previous php.notes (#5431) next »