Re: Referencing sequentially numbered variables

From: Date: Sun, 07 Oct 2001 04:16:03 +0000
Subject: Re: Referencing sequentially numbered variables
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-70277@lists.php.net to get a copy of this message
${"col$i"} On Sat, 6 Oct 2001, GF wrote: > I have 13 variables, col1-col13. Is there a way, other than making an > array, to address these variables in a loop? In some languages you are > allowed to reference these as if they were an array, i.e., col1 could be > addressed as col[1]. This does not seem to be the case with PHP. What I > would like to do, would be analagous to: > > for ($i=1;$1<14;$i++) { > $header .= $col[$i]; > } > > This does not work, but it demonstrates what I hope to be able to do. Is > this possible? > > > >

« previous php.general (#70277) next »