ich habe folgenden php code:
PHP-Code:
$typ=1;
switch ($typ) {
case '0':
echo "Text1";
case '1':
echo "Text2";
case '2':
echo "Text3";
}
Wieso springt er in "case '2'" rein, obwohl die Variable gar nicht 2 ist?
$typ=1;
switch ($typ) {
case '0':
echo "Text1";
case '1':
echo "Text2";
case '2':
echo "Text3";
}
<?php
$typ = 1;
switch ($typ) {
case 0:
echo "Text1";
break;
case 1:
echo "Text2";
break;
case 2:
echo "Text3";
break;
}
?>
<?php
switch($typ) {
case 0:
echo 'TEXT1';
break;
case 1:
echo 'TEST2';
break;
case 2:
echo 'TEST3';
break;
}
?>
Einen Kommentar schreiben: