RE: [PHP-DB] Variables

From: Date: Thu, 25 Apr 2002 15:57:54 +0000
Subject: RE: [PHP-DB] Variables
Groups: php.db 
Request: Send a blank email to php-db+get-18806@lists.php.net to get a copy of this message
I think what you don't know is this: $varName = "c1"; $$varName = 3; that just set $c1 to equal 3. Does that help? -----Original Message----- From: Julio Cuz, Jr. [mailto:jcuz@rccd.cc.ca.us] Sent: Thursday, April 25, 2002 9:56 AM To: php-db@lists.php.net Subject: [PHP-DB] Variables HI-- * I have the following variables: $c1 thru $c10. * I also have a FOR loop like this: for($count = 0; $count < sizeof($artist); $count++) { echo "<i>$artist[$count]</i><br>"; } // $artist is a list of ten (10) artist's names. * What I'm trying to do is something like this: Combine the variables with the info inside the FOR loop: for($count = 0; $count < sizeof($artist); $count++) { //Trying to assign the value of $c1, $c2, $c3, etc. using the value of the variable $count. //But so far, it only processes the value of $count alone, and it ignores $c //The line below should read like this: $c1 = $artist[0], next line: $c2 = $artist[1], etc. $c . $count+1 = $artist[$count]; } Help!!! Julio Cuz, Jr. Riverside Community College jcuz@rccd.cc.ca.us

« previous php.db (#18806) next »