Re: Accessing lots of variables

From: Date: Tue, 25 Sep 2001 21:01:51 +0000
Subject: Re: Accessing lots of variables
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-68776@lists.php.net to get a copy of this message
Try This... for($i=1; $i<=35; $i++) { $sVarName = "link$i"; if(empty($$sVarName)) {
      //Do Something
} else {
      //Do Something Else using $$sVarName...
} } -Jason Garber deltacron.com At 01:42 PM 9/25/2001 -0400, Jordan Elver wrote:
Hi, I'm feeling a bit stupid. I have a,load of variables coming from a MySQL connection using list(). The variables are link1 to link 35 inclusive. How can I access each of these variables, check if they are empty, then add them to an array. I don't know how to access then inside a for loop. Can I use $link and append the number on the end somehow? Any help please, Jord -- 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


« previous php.general (#68776) next »