Re: Accessing variables, with a for-loop
| From: | Chris Moyer | Date: | Mon, 19 Jun 2000 13:28:54 +0000 |
| Subject: | Re: Accessing variables, with a for-loop | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-2194@lists.php.net to get a copy of this message | ||
On Mon, Jun 19, 2000 at 02:30:22PM +0200, Erlend Strxmsvik wrote:
> Now I wonder if it could be possible to access these variables this way (or
> in some other easy way?)
>
> for ($i = 0; i < max; i++) {
> $variable$i // -Hmmmm Can I do this in some way? :)
> }
for($i = 0 ; $i < $max ; $i++){
$varname = "variable".$i;
echo ${$varname};
}
That should work fine.
-- Chris Moyer -- cmoyer@chekinc.com --
PHP Developer -- Chek.com