Konstruksi if-else dan Nilai Boolean
Misalkan kita memiliki variabel boolean tertentu,
yang dapat menerima nilai true
atau false:
<?php
$test = true;
?>
Mari kita tulis if yang memeriksa
variabel kita untuk nilai true:
<?php
$test = true;
if ($test === true) {
echo '+++';
} else {
echo '---';
}
?>
Periksa bahwa variabel $test
sama dengan true.
Periksa bahwa variabel $test
sama dengan false.