PHP ISSET

The isset() function checks whether a variable is set, which means that it has to be declared and is not NULL.

This function returns true if the variable exists and is not NULL, otherwise it returns false.

Check whether a variable is empty. Also check whether the variable is set/declared:
Note: If multiple variables are supplied, then this function will return true only if all of the variables are set.
Tip: A variable can be unset with the unset() function.

Syntax


isset(variable, ....);

eg. $x = $_POST[‘fisrt_name’];
if(isset($x)){code}

Parameter Values


Variable Required. Specifies the variable to check
... Optional. Another variable to check

<!DOCTYPE html>
<html>
<body>
 
<?php
$a = 0;
// True because $a is set
if (isset($a)) {
  echo "Variable 'a' is set.
"; } $b = null; // False because $b is NULL if (isset($b)) { echo "Variable 'b' is set."; } ?> </body> </html>

Did you like our works?

We are known for Website Development and Website Designing, along with Android iOS application development in Mumbai, India. Please write us what you think, we would like to hear it from you

1