No need to use variables $a
and $b
. Simply do this:
for ($i = 1; $i <3 ; $i++){
$c = $i.$i;
echo $c;
}
Update(1): Based on your edited question, the solution would be like this:
for ($i = 2; $i < 6 ; $i++){
$j = (int)($i/2);
$c = $j.$j;
echo $c . '<br />';
}
2
solved php echo strings for multiple times with order