AW: [PHP] variables in variables names
| From: | Sebastian Stadtlich | Date: | Thu, 23 Nov 2000 16:36:46 +0000 |
| Subject: | AW: [PHP] variables in variables names | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-26842@lists.php.net to get a copy of this message | ||
i think it should be:
${'a'.$i}
> -----Ursprüngliche Nachricht-----
> Von: Daniele Cesarini [mailto:cesarini@cline.it]
> Gesendet am: Donnerstag, 23. November 2000 17:03
> An: php-general@lists.php.net
> Betreff: [PHP] variables in variables names
>
> Hi, I need to do a thing like this:
>
> $a1 = 4;
> $a2 = 3;
> $a3 = 6;
>
> for ($i = 1; $i <= 18; $i++){
> echo "a$i= " . ${a$i}; <-- parse error
> }
>
> I guess it worked in php3, anyway what is the right syntax to
> write this
> in both php3 and php4?
>
> thx
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail:
> php-list-admin@lists.php.net
>