vendredi 13 novembre 2020

Please Explain this to me, i'm just new to php [closed]

On If Statement what does the ($n) and ($n2) represent

<?php

 For ($n = 1; $n <= 9; $n++) {
  For ($n2 = 1; $n2 <= $n; n2++) {
   If ($n % $n2 == 0) {
    Echo "$n ";
   }
  }
  Echo "<br>";
 }

?>

I'm a little bit confuse about the output

1
1 2
1 3
1 2 4
1 5
1 2 3 6
1 7
1 2 4 8
1 3 9

Please explain to me what $n and $n2 represent when it modulus on if statement (Sorry for my english)

Aucun commentaire:

Enregistrer un commentaire