I know Notice: Undefined index
error is about lack of isset()
.
Below statements doesn't get any errors or notices :
if (isset($_SESSION['userid'])) {
$userid = $_SESSION['userid'];
}
But following statements, get Notice: Undefined index
:
$userid = $_SESSION['userid'] ? isset($_SESSION['userid']) : NULL;
Please tell me why when using shorthand if/else
it get notice?