Example 1 — Set, Null and Missing Variables
Check a variable with a value, one set to null, and one that was never created.
<?php
$name = 'Asha';
$empty = null;
var_dump(isset($name));
var_dump(isset($empty));
var_dump(isset($missing)); How It Works
- $name holds text. It exists and is not null, so isset() returns true.
- $empty holds null. isset() treats null as not set, so the result is false.
- $missing was never created. isset() returns false and does not show a warning.
- No warning appears for the missing variable. This is the main reason isset() is so popular.

