problem with do while

1

toi doing a multiplication table I already have it in for and in while but I do not get the do while I do not know much about that instruction, I do not know what my error is

this is with while

<?php
$t=8;
$i=8;

while($t<=10){

    echo "<h3> Tabla del $t </h3>";
    while($i<=12){
        echo "$t x $i = ".($t*$i) . "<br/>";
        $i++;
    }

    $i=8;
    $t++;    
}


?>

I did with do while but the program does not do anything

<?php
$t=8;
$i=8;

do{
   echo "<h3> Tabla del $t </h3>";

      echo "$t x $i = ".($t*$i) . "<br/>";
      $i++;

 $i=8;
 $t++; 
}   while($t<=10);
    while($i<=12);

?>
    
asked by wdwd 04.10.2017 в 08:45
source

1 answer

0

You need 2 loops do while just like you have 2 while in the first example. You have a bit of mess with the brackets, it would look like this:

<?php

 $t=8;
 $i=8;

  do{
    echo "<h3> Tabla del $t </h3>";
    $i=8;

    do{     
       echo "$t x $i = ".($t*$i) . "<br/>";
       $i++;
    } while($i<=12);

  $t++;
  }while($t<=12);

?>
    
answered by 04.10.2017 / 08:49
source