PHP empty Keyword

P
PHP enddeclare Keyword
PHP elseif Keyword

In this article, you will learn how to check empty variables in PHP using empty keywords. The empty keyword in PHP acts as a function that returns true if a variable does not exist, or if its value is considered empty. The empty keyword also evaluates expressions that are not in a variable.

examples of the EMPTY keyword

Example 1. In this example, we check if a variable is empty.

<?php
$str = "";
if(empty($str)) {
  echo "The string is empty";
}
?>
PHP enddeclare Keyword
PHP elseif Keyword

Tutor Network

Share this

Learn PHP from A to Z