Re: variable

From: Date: Sun, 13 Aug 2000 11:59:51 +0000
Subject: Re: variable
Groups: php.db 
Request: Send a blank email to php-db+get-2004@lists.php.net to get a copy of this message
From the PHP manual: "In order to use variable variables with arrays, you have to resolve an ambiguity problem. That is, if you write $$a[1] then the parser needs to know if you meant to use $a[1] as a variable, or if you wanted $$a as the variable and then the [1] index from that variable. The syntax for resolving this ambiguity is: ${$a[1]} for the first case and ${$a}[1] for the second. " I hope this helps. Jayme. -----Mensagem original----- De: Christopher Cheng <chengcsw@netvigator.com> Para: php-db@lists.php.net <php-db@lists.php.net> Data: S墎ado, 12 de Agosto de 2000 23:19 Assunto: [PHP-DB] variable >Can I store the name of a particular element of an array to a variable so I >can reference to it? >The second one 456 doesn't seem to work. > ><? > $a = "b"; > $$a = 123; > echo $b; > > $a = "b[0]"; > $$a = 456; > echo $b[0]; >?> > > >-- >PHP Database Mailing List (http://www.php.net/) >To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net >For additional commands, e-mail: php-db-help@lists.php.net >To contact the list administrators, e-mail: php-list-admin@lists.php.net >

« previous php.db (#2004) next »