Is there a way to save a boolean true/false value in a function to a variable?
function check() {
if(1 = 1) {
return false;
}
}
$status = check();
if($status === false) {
echo "sign in please";
}
As of now $status
comes out to be null. I don't like having to use if(check() === false) {}
since a lot of my function have a lot of arguments. And setting $status
within the function would defeat the purpose of a universal function that can be used for multiple variables.
How do you guys handle this?
EDIT: I apologize, something else in my code was causing it to be null. Tried to make a test (above code) and when it failed, I thought it was a worthy question :P