0
$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?

1 Answers1

1

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'];
}
Darren
  • 13,050
  • 4
  • 41
  • 79