PHP empty Keyword

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

Stay up-to-date about PHP!

We don’t spam!

en English
X
Scroll to Top