Re: multi-dimensional array won't echo

From: Date: Sat, 25 Aug 2001 23:02:09 +0000
Subject: Re: multi-dimensional array won't echo
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-64460@lists.php.net to get a copy of this message
Not only a good answer, but the best explanation. thanks, bill hollett Rasmus Lerdorf wrote: > > The first echo statement doesn't work, the second does. Anybody know > > why? > > > > $string1=15; > > $string2=27; > > $myarray[$string1][$string2]="syncopated"; > > echo "$myarray[$string1][$string2]<br />\n"; //displays Array[27] > > echo $myarray[$string1][$string2] . "<br />\n"; //displays syncopated > > Complex variables inside quoted strings need to be dereferenced using {}'s > > eg. > > echo "{$myarray[$string1][$string2]}<br />\n"; > > Or better yet: > > echo $myarray[$string1][$string2] . "<br />\n"; > > -Rasmus

« previous php.general (#64460) next »