note 49357 added to ref.session

From: Date: Tue, 25 Jan 2005 13:18:25 +0000
Subject: note 49357 added to ref.session
Groups: php.notes 
Request: Send a blank email to php-notes+get-83923@lists.php.net to get a copy of this message
Just like some other array mentioned somewhere on the php.net site, if you try to use something like: <?php for($i=0;$i<9;$i++){ $_SESSION[$i] = ($i * $i) . " is a number"; } ?> it won't store the data... why?? it seems that an element key of an integer type just doesn't work.. my solution is to simply prepend a string at the beginning of the key. such as: <?php for($i=0;$i<9;$i++){ $_SESSION["i" . $i] = ($i * $i) . " is a number"; } ?> I think the $_COOKIE array does this too..... any ideas?? ---- Manual Page -- http://www.php.net/manual/en/ref.session.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+49357 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+49357&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+49357&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+49357&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+49357&report=yes&reason=useless Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+49357&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+49357&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#83923) next »