Konstruksi if-else dan nilai boolean

Katakan kita mempunyai pembolehubah boolean, yang boleh mengambil nilai true atau false:

php<?php
  $test = true;
?>

Mari tulis if yang memeriksa pembolehubah kita untuk nilai true:

php<?php
  $test = true;
  
  if ($test === true) {
    echo '+++';
  } else {
    echo '---';
  }
?>
Задание 1

Periksa bahawa pembolehubah $test sama dengan true.

Задание 2

Periksa bahawa pembolehubah $test sama dengan false.