i would like to create a php function. Basically, that's what i've :
if(isset($myvariable) AND $myvariable == "something")
{
echo 'You can continue';
}
and that's what i want :
if(IssetCond($myvariable, "something"))
{
echo 'You can continue';
}
I want function that tests if the variable exists, and if it does it tests if the condition is respected. Otherwise it returns false.
I've tried a lot of things, but i still have a problem when $myvariable doesnt exist.
function IssetCond($var, $value){
if(isset($var) AND $var == $value)
{
return true;
}
else
{
return false;
}
}
When $myvariable exists and whether the condition is respected or not, it works.
If you have some minutes to help me i'll be grateful.
Thanks
Thomas
{}on same line - there isn't necessarily strict PHP standards but a standard has been slowly building. SecondlyANDcan be shortened to&&IssetCondand not because of the variable's scope