Member Avatar for P0lT10n

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 for P0lT10n

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 !

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.