Reputation: 3323
I have the following:
$textq1 = 'text';
$textq2 = 'more text';
I have a loop:
for ($i = 1; $i <= 70; $i++) {
echo "<div>". $textq1." ";
}
Now....what I'd like to do is, within the loop have the 1
part of the $textq1
be the value of $i
.
Is that possible?
Upvotes: 1
Views: 116
Reputation: 382909
Change:
echo "<div>". $textq1." ";
To:
echo "<div>". ${'textq'.$i} ." ";
Upvotes: 3
Reputation: 50640
Take a look at this example about variable variables
in the PHP docs:
http://www.php.net/manual/en/language.variables.variable.php#105282
Upvotes: 0