which1ispink which1ispink - 6 months ago 33
PHP Question

What does this PHP syntax mean? (question marks)

What does this line of PHP code mean? That is, the question mark bit followed by true, colon, false?

return(isset($_SESSION['id'])) ? true : false;

kba kba
Answer

It's a ternary operator.

It's simply short-hand for:

if (isset($_SESSION['id']))
  return true;
else
  return false;