Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 06/26/2021 in all areas

  1. The modulo operator was invented for situations like this $mytext = "I &#10084; PHP"; for ($i=1; $i<=100; $i++) { echo "$i<br>"; if ($i % 5 == 0) echo "$mytext<br>"; }
    1 point
  2. I'm sure you noticed, but you're counting from 0 to 42. Should be easy to change to count from 1 to 100, right? So you can list out all the numbers you want to output a message after, but you have to list them all out. What if you needed a loop from 1 to 1000? Or a million? What would you do then? You want to output at 5, 10, 15, etc. In other words, numbers divisible by 5. Have you tried looking for a solution using something that can tell you if a number is divisible by 5?
    1 point
This leaderboard is set to New York/GMT-04:00
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.