PHP: why is this null different from the other null

Posted by matthy on Stack Overflow See other posts from Stack Overflow or by matthy
Published on 2010-03-14T14:25:04Z Indexed on 2010/03/14 14:35 UTC
Read the original article Hit count: 515

Filed under:
|
|
|

hi i tried 2 things what should be the same however it my testing says different does anyone know why the only thing i do is put it in a variable...

    if ($_SESSION[$something] === null)
        echo("this is null");

$_SESSION[$something] does not exists so it indeed says: "this is null". now look at this

$theSession = $_SESSION[$something];

if (theSession === null)
    echo("this is null");

now it does not say "this is null" while it should be exactly the same right?

© Stack Overflow or respective owner

Related posts about php

Related posts about null