The empty Command in PHP

Often in scripts, there is a need to check a variable for emptiness. In PHP, a variable will be empty if it is equal to 0, '', '0', false or null.

The check for emptiness is performed using the empty command:

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

More often, however, the inverse task arises - checking that a variable is not empty. Let's invert our condition:

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

Without running the code, determine what will be displayed on the screen:

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

Without running the code, determine what will be displayed on the screen:

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

Without running the code, determine what will be displayed on the screen:

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

Without running the code, determine what will be displayed on the screen:

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

Without running the code, determine what will be displayed on the screen:

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

Without running the code, determine what will be displayed on the screen:

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

Without running the code, determine what will be displayed on the screen:

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

Without running the code, determine what will be displayed on the screen:

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

Without running the code, determine what will be displayed on the screen:

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

Without running the code, determine what will be displayed on the screen:

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

Without running the code, determine what will be displayed on the screen:

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