Switch kontrol yapısı için bir kaç basit örnek görelim.
Switch php de string değerlerin kontrolünü yapmak için kullanılır.
Kod:<?php
$sayi1=5;
Switch ($sayi1) {
case 5:
echo "Sayı değişkeni <font color=red><b>$sayi1 </b></font>değerini içeriyor";
break;
}
echo "<br><br>";
$ad="İsmail";
Switch ($ad) {
case İsmail:
echo "Ad değişkeninin değeri <font color=red><b>$ad</b></font> 'dır";
break;
}
?>
