View Single Post
# 1 10-02-2006 , 08:46 PM
Registered User
Join Date: Feb 2006
Posts: 2

for-loop: how to print variable data instead of variable name?

hi, i've got a new problem. it seems as if there was a simple solution, but i just don't figure out how to find it.
what i've got:

6 variables:

$digit2=0;
$digit3=1;
$digit4=0;
$digit5=1;
$digit6=0;
$digit7=1;

and i want to print their value from a for-loop

for ($i=2; $i<=7; $i++) {
print ?????;
}

but the only thing i can think of is to write it like this: print ("$digit" + $i);
and that of course only prints out the variable names instead of the values i want...

i hope you can help me
thanks in advance,
yours

joh