Add information to a variable after loop?
Posted: Mon Sep 27, 2010 5:46 pm
Is there a way to add new data to a variable after each passing through a loop? After the original data that is. Or is there some other way to make this script work? This is what i want to do:
If the input is 2, the output should be:
Thanks!
If the input is 2, the output should be:
if it is 3 it should output:x
xx
This is what i got so far...x
xx
xxx
Code: Select all
<?php
$input = 3;
$i = 1;
$x = "x";
while ($i <= $input) {
echo $x."<br>";
$i++;
}
?>