<?php
//variable declaration
$time = 10;

//Normal If/Else Operation
if ($time == 10) {
echo "if/else good morning!"."\n\n";
} elseif ($time == 20) {
echo "if/else good day!"."\n\n";
} else {
echo "if/else good night!"."\n\n";
}

//Nested Ternary Operation
$data = ($time==10) ? "Ternary good morning!" : (($time==20) ? "Ternary good day!" : "Ternary good night!");
echo $data."\n";
?>

LEAVE A REPLY

Please enter your comment!
Please enter your name here