<?php
$a = 10;
$b = 10;
$proses = "pembagian";
switch($proses)
{
case "perkalian" :
$hasil = $a * $b;
break;
case "penjumlahan" :
$hasil = $a + $b;
break;
case "pengurangan" :
$hasil = $a - $b;
break;
case "pembagian" :
$hasil = $a / $b;
break;
default:
$hasil = "Error Tidak ada hasil";
break;
}
echo "Hasil $proses = " . $hasil;
?>