I am not to sure if this is possible but it would very useful if it could be done.
this is what I have for variables
$class1,$class2,$class3,...,$class10, and $count
I want to print out the information in these variables without having to specifically write code to do so for each one.
psuedo code:
count = 1;
while(count <= 10)
echo class"count"; // aka class1 or class2, whichever count is.
I want it to output the data in each of the variables. I have tried this with a couple of different syntaxes but none of them have worked. Is this even possible?
Thanks!
Mark
Help on this would be greatly appreciated
Moderator: General Moderators
why not make them
or something
Code: Select all
$classї1]
$classї2]
// and so forth
// then
foreach ($class as $key){
print "$key";
}you may also use the eval()-function
but if this is a good idea.......
Code: Select all
for ($i=1; $i!=11;$i++)
{
eval ("print("$class$i<br>");");
}