Re: Accessing variables, with a for-loop
| From: | stephan dot schoell at chhos dot mail dot abb dot com | Date: | Mon, 19 Jun 2000 12:59:37 +0000 |
| Subject: | Re: Accessing variables, with a for-loop | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-2190@lists.php.net to get a copy of this message | ||
you might write the following test code which worked for me:
<?php
$variable1="a";
$variable2="b";
$variable3="c";
$variable4="d";
$variable5="e";
$max=5;
for ($i=1;$i<=$max;$i++) {
$var="variable".$i;
$variable[$i]=$$var; //now you have the array you want!
echo $variable[$i]."<br>";
}
?>
HTH Steff
|------------->
|(Embedded |
|image moved |
|to file: |
|pic11850.pcx)|
| |
|------------->
>------------------------------------------------------------------------|
|Erlend Strømsvik <stromsvi@tapir.no> |
|19.06.2000 14:30 |
>------------------------------------------------------------------------|
To: php-general@lists.php.net
cc: (bcc: Stephan Schoell/CHHOS/ABB)
Subject: [PHP-GENERAL] Accessing variables, with a for-loop
Security Level:? Internal