-3
Hello, sorry for the ignorance is that I am now entering the back-end and I need a 'for' that repeats the same number of 4 in 4, at each repetition it increments, receives one more FOR EXAMPLE:
MUST PRINT LIKE THIS:
111222333444555666777...
Here’s the code that’s not working:
$x=0;
for ($i = 1; $i <= 28; $i++) {
if($x<=4){
$x++;
echo $x;
}else{
$x=0;
$i=$i-1;
}
}
What is the value of
$x
? This code will not compile. I believe you wanted to use$i
in place of$x
.– Pedro Gaspar