You don't want to print either 4 or 6, so you should be using &&.
The statement if($i != 4 || $i != 6) will trigger whenever $i is not equal to 4, or whenever $i is not equal to 6. Considering 4 is not equal to 6, it will trigger in both cases. It will reach $i = 4, and realise that $i is not equal to 6. This will step into the condition, as you say it only has to hold true for one or the other.
The statement if($i != 4 && $i != 6) implies that $i is not equal to 4 and $i is not equal to 6. Both conditions must hold true at the same time. When $i = 4, $i != 6 will be true, but $i != 4 will be false. Both conditions need to be true, so it will fail. Essentially, this could be rewritten as:
for($i = 0; $i <= 10; $i++){
if($i != 4) {
if($i != 6) {
echo $i."<br/>";
}
}
}
To skip over the numbers 4 and 6 in the loop, you have to use the and condition:
for($i = 0; $i <= 10; $i++){
if($i != 4 && $i != 6){
echo $i."<br/>";
}
}
Hope this helps!
$i != 4 || $i != 6is always true. It could only be false for aniwhich is both4and6at the same time...&&