Hallo cpers
Wat is nou het verschil tussen Switch en If.
Want je kan hetzelfde ermee doen.
Switch
PHP
$x = 1;
switch ($x)
{
case 1:
echo "It is one";
break;
case 2:
echo "It is two";
break;
default:
echo "It is not one or two";
}
Toon Meer
If (elseif, else)
PHP
$x = 1;
if ($x == 1)
echo "It is one";
elseif ($x == 2)
echo "It is tow";
else
echo "It is not one or two";
Wie weet nou het echte duidelijke verschil tussen deze twee?