I am teaching myself PHP and have a question about IF and CASE. They seem quite similar to me, and was wondering if somebody could explain the main difference, or why/when I would use one over the other.
The example I am looking at it fairly basic - see below;
IF
if ($i == 1 ||
$i == 2 ||
$i == 3) {
echo '$i is somewhere between 1 and 3.';
}
CASE
case 1:
case 2:
case 3:
echo '$i is somewhere between 1 and 3.';
break;
I am new to php and appreciate any advice.