note 39470 added to ref.session

From: Date: Thu, 29 Jan 2004 17:43:46 +0000
Subject: note 39470 added to ref.session
Groups: php.notes 
Request: Send a blank email to php-notes+get-64387@lists.php.net to get a copy of this message
Oh, how I wish I had read this sentence on this page before wasting hours today: "The keys in the $_SESSION associative array are subject to the same limitations as regular variable names in PHP, i.e. they cannot start with a number [...]" So, don't do <?php $_SESSION[0] = "whatever"; ?> and expect "whatever" to be available on the next page. Also to expand on what "christophe" mentioned on 18. Dec 2003 about garbage collection, in fact garbage collection occurs (100 * session.gc_probability / session.gc_divisor) percent of the time a visitor calls up a page which uses sessions. By default, this is once every 100 page requests, on average. If you wanted garbage collection to occur once every 1000 requests, you'd keep gc_probability at 1 and set gc_divisor to 1000. What remains unclear to me is the definition of session.gc_maxlifetime. Is a session considered "garbage" when the current time is this many seconds after the session was created, or this many seconds after it was last accessed? ---- Manual Page -- http://www.php.net/manual/en/ref.session.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+39470 Delete -- http://master.php.net/manage/user-notes.php?action=delete+39470&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+39470&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#64387) next »