pTutorial

New way to learn Programming

How To Check Variable Is Set Or Not In PHP

how to check variable is set or not in PHP

PHP isset() function is used to determine whether the passed variable is set or not. The isset function return true if the given variable having some value other than false, NULL.

PHP isset() function example

<?php
$temp="pTutorial";
unset($temp);
if (isset($temp)){
	echo "The variable is set";
}
else{
	echo "The variable is not set!";
}
?>

Output

The variable is not set!

Explanation

You can also use PHP isset() function to determine whether an array key exist or not.

See Also


QUOTES OF THE DAY

Well-begun is half done.

LIKE ON FACEBOOK

+1 ON GOOGLE

SHARE ON TWITTER