REPEAT NUMBERS 4 IN 4 TIMES IN PHP

-3

Hello, sorry for ignorance is that I am now entering the back end and need a 'for' that repeats the same number of 4 in 4, every one repetition it increments, gets one more BY:

YOU MUST PRINT THIS:

111222333444555666777 ...

Here is the code that is not working:

    $x=0;
    for ($i = 1; $i <= 28; $i++) {
        if($x<=4){
        $x++;
        echo $x;

    }else{
       $x=0;
       $i=$i-1;  
     }
  }
    
asked by anonymous 07.11.2018 / 03:11

1 answer

2
for ($i = 1; $i <= 28; $i++) {
    echo "$i$i$i";
}

So?

    
07.11.2018 / 03:14