Problems with the PHP session
Posted: Mon Sep 17, 2007 7:05 am
Code: Select all
<?php
session_start();
$_SESSION['joy'] = 'happy';
$joy = 'joy joy';
echo $_SESSION['joy'];
?>A community of PHP developers offering assistance, advice, discussion, and friendship.
http://forums.devnetwork.net/
Code: Select all
<?php
session_start();
$_SESSION['joy'] = 'happy';
$joy = 'joy joy';
echo $_SESSION['joy'];
?>register_globals does not make $_SESSION['joy'] and $joy point to the same memory address. register_globals actually copies the values from the superglobal arrays into variables. So, when you change $joy, the actual $_SESSION['joy'] is not altered, but the final session data is.fastfingertips wrote:With the register globals turned on, when i run this script first time i got "happy" at the second echo, but when i make refresh and any refresh after that i get "joy joy", can you explain me why this happens? It seems like writing the new value in the session file is delayed and i don't understand why.