What potential issues can arise when using logical operators like || (OR) and && (AND) in PHP while loop conditions?

Potential issues that can arise when using logical operators like || (OR) and && (AND) in PHP while loop conditions include incorrect evaluation of the conditions, leading to unexpected loop behavior. To solve this issue, it is important to use parentheses to explicitly define the order of operations for the conditions within the while loop.

<?php
// Incorrect usage of logical operators in while loop condition
$num1 = 5;
$num2 = 10;

// Incorrect: This will not work as expected due to missing parentheses
// while ($num1 < 10 || $num2 < 15) {
//     echo "Inside while loop\n";
//     $num1++;
//     $num2++;
// }

// Correct: Using parentheses to explicitly define the order of operations
while (($num1 < 10) || ($num2 < 15)) {
    echo "Inside while loop\n";
    $num1++;
    $num2++;
}
?>