if, elseif, else ကို condition ပေါ်မူတည်ပြီး မတူတဲ့ code block တွေ run ဖို့သုံးပါတယ်။ ဥပမာ user login ဝင်ထားလား၊ stock ရှိလား၊ age ပြည့်လား၊ form မှန်လား စတာတွေ။
php
<?php
$score = 82;
if ($score >= 90) {
echo "Grade A";
} elseif ($score >= 80) {
echo "Grade B";
} elseif ($score >= 60) {
echo "Grade C";
} else {
echo "Try again. Practice is the real cheat code.";
}
?>You should see
Grade B