Difference between isset() and unset() in PHP
In : MCA Subject : Open Source Web Based ProgrammingISSET() FUNCTION
Syntax : isset($variable1, $variable2, $variable3, $…..);
this predefined boolean function is used to examine whether the value of a variable is set or not. It can be used to examine more than one variable as well.
Similar type of parameters(variables) can be used multiple times as shown in the syntax above.
$variable1- it represents the first variable to be examined.
$variable2- second variable to be examined.
$variable3- third variable to be examined.
$…..- other variables to be examined, if any.
Isset() function is used to pass only the variables. If parameters other than variables are passed, it will show a Parse Error.
UNSET() FUNCTION
Syntax : unset($variable1, $variable2, $variable3, $…..);
This predefined function is used to clear or unset a specified variable in the php script. It can be used to unset more than one variable as well.
Following are the parameters used in the unset() function.
$variable1- it represents the first variable to be cleared.
$variable2- second variable to be cleared.
$variable3- third variable to be cleared.
$…..- other variables to be cleared, if any.
Like isset() function, this is also used to pass only the variables, passing others will result in a Parse Error.