isset() function in PHP
by Nirmala[ Edit ] 2010-05-04 16:40:11
isset() function:
isset() determines whether a certain variable has already been declared by PHP. It returns a boolean value true if the variable has already been set, and false otherwise, or if the variable is set to the value NULL.
Consider the following script:
if (isset($first_name)) {
print '$first_name is set';
}
This code snippet checks whether the variable $first_name is defined. If $first_name is defined, isset() returns true , which will display ' $first_name is set. ' If it isn’t, no output is generated.