How to use isset() in Laravel?
1
Solution:
isset() Function
The isset() function is used to check whether a variable is set, which means that it has to be declared and is not NULL. This function will return true if the variable exists and is not NULL, else it returns false.
Example
An example to check whether a variable is empty. It also checks whether the variable is set/declared:
$num_1 = 0;
// True because $num_1 is set
if (isset($num_1 )) {
echo "Variable 'num_1' is set.<br>";
}
$num_2= null;
// False because $num_2 is NULL
if (isset($num_2)) {
echo "Variable 'num_2' is set.";
}