Member Avatar

Hello all Community !

My question is very simple:

What is the difference between $_SESSION['id'] and $_SESSION[id] ? Both works the same ! What is better ?

Does anyone know which is faster ?

Thanks all ;) !

The first one is the only correct way. Although the second (still) works, it is first parsed as a constant but not found, then parsed as a string (thus slower), but invalid code anyway. It may not work or cause errors in future versions.

Member Avatar

The first one is the only correct way. Although the second (still) works, it is first parsed as a constant but not found, then parsed as a string (thus slower), but invalid code anyway. It may not work or cause errors in future versions.

Thanks ! I thought the same about the second one !