|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2005-03-30 07:25 UTC] sniper@php.net
[2005-04-01 02:12 UTC] ceo at l-i-e dot com
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Dec 19 15:00:01 2025 UTC |
Description: ------------ <?php session_start(); if (!isset($_SESSION['name'])){ $_SESSION['name'] = 'Richard Lynch'; } else{ $name = $_SESSION['name']; } /* Assume a ton of code goes here */ $name = 'Fooey'; echo "Session name is: ", $_SESSION['name'], "<br />\n"; ?> Now, hit this page, re-load it, and what do *YOU* expect $_SESSION['name'] to output? A) 'Richard Lynch', because you never re-assigned $_SESSION['name'] B) 'Fooey' because $name is a reference, and you changed it, so that changed your session data. *I* expected A) Alas, the reality is B)