What are the potential pitfalls of using a loop to check for numbers divisible by 50 in PHP?

Using a loop to check for numbers divisible by 50 in PHP can be inefficient, especially if the range of numbers is large. Instead, you can use a mathematical approach by calculating the remainder of each number divided by 50. If the remainder is 0, then the number is divisible by 50.

// Using a mathematical approach to check for numbers divisible by 50
for ($i = 1; $i <= 100; $i++) {
    if ($i % 50 == 0) {
        echo $i . " is divisible by 50\n";
    }
}