note 21651 deleted from language.types.array by tomsommer

From: Date: Sat, 03 Jul 2004 13:26:43 +0000
Subject: note 21651 deleted from language.types.array by tomsommer
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-72428@lists.php.net to get a copy of this message
Note Submitter: phresno@concept-factory.com ---- to echo multidimensional arrays put the variable in {}'s example: <?php for($i=0;$i<=2;$i++) { for($j=0;$j<=2;$j++) { $array[$i][$j] = $i + $j; echo "Array[$i][$j]: $array[$i][$j]\n"; } } ?> displays: Array[0][0]: Array[0] Array[0][1]: Array[1] Array[0][2]: Array[2] Array[1][0]: Array[0] Array[1][1]: Array[1] Array[1][2]: Array[2] Array[2][0]: Array[0] Array[2][1]: Array[1] Array[2][2]: Array[2] while the code: <?php for($i=0;$i<=2;$i++) { for($j=0;$j<=2;$j++) { $array[$i][$j] = $i + $j; echo "Array[$i][$j]: {$array[$i][$j]}\n"; } } ?> will properly display the values as such: Array[0][0]: 0 Array[0][1]: 1 Array[0][2]: 2 Array[1][0]: 1 Array[1][1]: 2 Array[1][2]: 3 Array[2][0]: 2 Array[2][1]: 3 Array[2][2]: 4

« previous php.notes (#72428) next »