Re: Variable variables

From: Date: Tue, 20 Jun 2000 12:00:27 +0000
Subject: Re: Variable variables
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-2289@lists.php.net to get a copy of this message
On Tue, Jun 20, 2000 at 10:34:22AM +0200, Adam Helms wrote: > echo $b[holdnavn] //outputs "Denmark" > echo $a[Denmark][score] //outputs "5" > > Now i would like to include $b[holdnavn] in the second, like this: > > $a[{$b[holdnavn]]}[score], which should output "5". > your curly brackets don't match up, but ignoring that. the following works fine. <? $b[holdnavn] = "Denmark"; $a[Denmark][score] = 5; echo "$b[holdnavn]<br>", $a[Denmark][score], "<br>"; echo $a[$b[holdnavn]][score], "<br>\n"; ?> I have found that echo "$a[$b[holdnavn]][score]", "<br>\n"; doesn't work. I think that when putting things like this in quotes get's them parsed the wrong (unexpected) way. Cheers Fred -- Frederik Strauss +27-82-468-4679 Obsidian Systems http://www.obsidian.co.za

« previous php.general (#2289) next »