isset

PHP 4, PHP 5, PHP 7, PHP 8
isset - Determine if a variable is declared and is different than null
Manual
Code Examples

isset( mixed$var, ... mixed$vars ): bool

Determine if a variable is considered set, this means if a variable is declared and is different than null.

If a variable has been unset with the unset function, it is no longer considered to be set.

isset will return false when checking a variable that has been assigned to null. Also note that a null character ("\0") is not equivalent to the PHP null constant.

If multiple parameters are supplied then isset will return true only if all of the parameters are considered set. Evaluation goes from left to right and stops as soon as an unset variable is encountered.

Parameters

var

The variable to be checked.

vars

Further variables.

Return Values

Returns true if var exists and has any value other than null. false otherwise.

Notes

Warning:

isset only works with variables as passing anything else will result in a parse error. For checking if constants are set use the defined function.

Note:

Because this is a language construct and not a function, it cannot be called using variable functions, or named arguments.

Note:

When using isset on inaccessible object properties, the __isset() overloading method will be called, if declared.

Related Functions

Example of isset

Show all examples for isset

PHP Version:


Function isset:

Variable handling Functions

Most used PHP functions