PonchoX
03-22-2010, 06:34 AM
hi.
learning PHP.
this code works fine:
for ($count = -3; $count <= 10; $count++) {
if ($count == 5) {
continue;
}
echo $count . ", ";
}
As expected, this outputs:
-3, -2, -1, 0, 1, 2, 3, 4, 6, 7, 8, 9, 10,
So how come I get nothing (no error, but no output) if I use 'or', like so:
for ($count = -3; $count <= 10; $count++) {
if ($count == 5 || 6) {
continue;
}
echo $count . ", ";
}
I would expect it to output -3 to 10, skipping 5 and 6.
learning PHP.
this code works fine:
for ($count = -3; $count <= 10; $count++) {
if ($count == 5) {
continue;
}
echo $count . ", ";
}
As expected, this outputs:
-3, -2, -1, 0, 1, 2, 3, 4, 6, 7, 8, 9, 10,
So how come I get nothing (no error, but no output) if I use 'or', like so:
for ($count = -3; $count <= 10; $count++) {
if ($count == 5 || 6) {
continue;
}
echo $count . ", ";
}
I would expect it to output -3 to 10, skipping 5 and 6.