Skip to main content
Active reading [<https://en.wiktionary.org/wiki/first#Adjective> <https://www.youtube.com/watch?v=1Dax90QyXgI&t=17m54s> <https://www.youtube.com/watch?v=1Dax90QyXgI&t=0m38s> <https://en.wikipedia.org/wiki/Variable_%28computer_science%29>].
Source Link
Peter Mortensen
  • 31.4k
  • 22
  • 110
  • 134

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";
}

In PHP you need fist to define the variable after that you can use it.
We can check variable is defined or not in 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 variable is define or undefine
//Isset() does not check that variable has true or false value
//But it check null value of variable
if(isset($my_variable_name)){

}

Simple Explanation

//It will work with :- true,false,NULL
$defineVarialbe = false;
if($defineVarialbe){
    echo "true";
}else{
    echo "false";
}

//It will check variable is define or not and variable has null value.
if(isset($unDefineVarialbe)){
    echo "true";
}else{
    echo "false";
}

In PHP you need first to define the variable. After that you can use it.

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 defined or undefined
// Isset() does not check that variable has a true or false value
// But it checks the null value of a variable
if(isset($my_variable_name)){

}

Simple Explanation

// It will work with: true, false, and NULL
$defineVariable = false;
if($defineVariable){
    echo "true";
}else{
    echo "false";
}

// It will check if the variable is defined or not and if the variable has a null value.
if(isset($unDefineVariable)){
    echo "true";
}else{
    echo "false";
}
Source Link

In PHP you need fist to define the variable after that you can use it.
We can check variable is defined or not in 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 variable is define or undefine
//Isset() does not check that variable has true or false value
//But it check null value of variable
if(isset($my_variable_name)){

}

Simple Explanation

//It will work with :- true,false,NULL
$defineVarialbe = false;
if($defineVarialbe){
    echo "true";
}else{
    echo "false";
}

//It will check variable is define or not and variable has null value.
if(isset($unDefineVarialbe)){
    echo "true";
}else{
    echo "false";
}
Post Made Community Wiki by Manish Goswami