Thank You Andrey, Matt and Martin for your answers. To summarize for everyone, here are the answers:
From Andrey (tested, works): for($m=1;$m<=5;$m++){ $div_id[$m]=${'divid'.$m}; } From Matt: for($m=1;$m<=5;$m++){ $varName = 'divId' . $m; $div_id[$m]=${$varName} } From Martin: for($i =0; $i < 5; $i++) { $offset = $m + 1; $divid[$m] = $div_id{$offset}; } At 10:55 PM 7/26/2002 +0300, you wrote: >----- Original Message ----- >From: "Steve Buehler" <[EMAIL PROTECTED]> >To: "PHP" <[EMAIL PROTECTED]> >Sent: Friday, July 26, 2002 10:48 PM >Subject: [PHP] filling an array > > > > Can anyone tell me what I am doing wrong? > > > > I am essentially trying to do this: > > $divid[1] = $div_id1; > > $divid[2] = $div_id2; > > $divid[3] = $div_id3; > > $divid[4] = $div_id4; > > $divid[5] = $div_id5; > > > > But I was looking for a tighter way, like the following (which does not >work): > > for($m=1;$m<=5;$m++){ > > $div_id[$m]=$divid$m; > > } > > > > Can anybody tell me how to do this in a "for" statement? > > > > Thanks In Advance > > Steve > > > > > > -- > > This message has been scanned for viruses and > > dangerous content by MailScanner, and is > > believed to be clean. > > ow3 > > > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > >-- >This message has been scanned for viruses and >dangerous content by MailScanner, and is >believed to be clean. >ow3 -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. ow3 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php