PHP'de isset Komutu

Şu değişkenimiz olduğunu varsayalım:

php<?php
  $test = null;
?>

Değişkenin null olmadığını kontrol eden bir koşul yazalım:

php<?php
  $test = null;
  
  if ($test !== null) {
    echo '+++';
  } else {
    echo '---';
  }
?>

Böyle bir kontrol, özel isset komutu kullanılarak daha kolay yapılabilir:

php<?php
  $test = null;
  
  if (isset($test)) {
    echo '+++';
  } else {
    echo '---';
  }
?>

Değişkenin tanımlanmadığı ters kontrol de yapılabilir. Bunun için isset mantıksal DEĞİL ile ters çevrilir:

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

Aşağıdaki kodu öğrenilen teoriye göre değiştirin:

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

Aşağıdaki kodu öğrenilen teoriye göre değiştirin:

php<?php
  $test = null;
    
  if ($test != null) {
    echo '+++';
  } else {
    echo '---';
  }
?>