In PHP you need fistfirst to define the variable after. After that you can use it.
We
We can check if a variable is defined or not in a very efficient way!.
// If you only want to check variable has value and value has true and false value.
// But variable must be defined first.
if($my_variable_name){
}
// If you want to check if the variable is definedefined or undefineundefined
// Isset() does not check that variable has a true or false value
// But it checkchecks the null value of a variable
if(isset($my_variable_name)){
}
Simple Explanation
Simple Explanation
// It will work with :- true, false, and NULL
$defineVarialbe$defineVariable = false;
if($defineVarialbe$defineVariable){
echo "true";
}else{
echo "false";
}
// It will check if the variable is definedefined or not and if the variable has a null value.
if(isset($unDefineVarialbe$unDefineVariable)){
echo "true";
}else{
echo "false";
}