maximus06
03-11-2009, 05:54 AM
I've worked with PHP for a very long time, and yet this simple issue just shatters my world. It makes no sense to me whatsoever :/
<?php
session_start();
$_SESSION["user"] = "lalala";
echo $_SESSION["user"];
$user = 'new';
echo "<br>".$_SESSION["user"];
?>
Output:lalalal
new
I discovered this behavior of a normal variable affecting a SESSION variable of the same name as the source of a much larger problem, but simplified it down to those 5 lines.
How the hell is $user affecting the SESSION array? It makes absolutely no sense to me :/
<?php
session_start();
$_SESSION["user"] = "lalala";
echo $_SESSION["user"];
$user = 'new';
echo "<br>".$_SESSION["user"];
?>
Output:lalalal
new
I discovered this behavior of a normal variable affecting a SESSION variable of the same name as the source of a much larger problem, but simplified it down to those 5 lines.
How the hell is $user affecting the SESSION array? It makes absolutely no sense to me :/