isset php function

Sunday, May 9, 2010 |


iseset function : check if variable is (set | available) or not empty in your php script and return bool (true | false) result


exampel :


$var = 0 ;
if(isset($var)){
echo 'variable "$var" is available to use';
}else{
echo 'variable "$var" isn\'t available to use';
}

result :

variable "$var" isn't available to use


another example :


// we didn't create variable "$var"

if(isset($var)){
echo 'variable "$var" is available to use';
}else{
echo 'variable "$var" isn\'t available to use';
}

result :

variable "$var" isn't available to use


isset it's very important function to check if your variable is okay to use or not

0 التعليقات: