$userauthorized = empty($_SESSION['userauthorized']) ? 0 : $_SESSION['userauthorized'];
I'm sure this is an elementary question and googling this is a nightmare.
What does the " ? 0 : " mean?
$userauthorized = empty($_SESSION['userauthorized']) ? 0 : $_SESSION['userauthorized'];
I'm sure this is an elementary question and googling this is a nightmare.
What does the " ? 0 : " mean?
It's called a ternary operator and it is essentially a short-hand if()
statement.
You're basically saying:
if(empty($_SESSION['userauthorized'])) {
$userauthorized = 0;
} else {
$userauthorized = $_SESSION['userauthorized'];
}