which1ispink which1ispink - 1 year ago 58
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 Source

It's a ternary operator.

It's simply short-hand for:

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