niche Posted December 6, 2010 Share Posted December 6, 2010 this works: array(1) { ["snpos"]=> string(1) "5" }$pos = 5;$pos = strval($pos);$_SESSION['snpos'] = $pos;echo var_dump($_SESSION) . '</br>'; but this doesn't: array(1) { ["snpos"]=> int(5) } $pos = 5;$_SESSION['snpos'] = $pos;echo var_dump($_SESSION) . '</br>'; Why can't I define a session key with a INT value? Link to comment Share on other sites More sharing options...
thescientist Posted December 6, 2010 Share Posted December 6, 2010 did you check the manual page?http://www.php.net/manual/en/session.examples.basic.phpit's right there at the top: 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 and must start with a letter or underscore. Link to comment Share on other sites More sharing options...
niche Posted December 6, 2010 Author Share Posted December 6, 2010 except in this case 5 is the value of the key correct? Link to comment Share on other sites More sharing options...
thescientist Posted December 6, 2010 Share Posted December 6, 2010 Hmm, I just read your question Why can't I define a session key with a INT value?and replied to that.So upon reflection, what about this:array(1) { ["snpos"]=> int(5) } is a problem? Link to comment Share on other sites More sharing options...
niche Posted December 6, 2010 Author Share Posted December 6, 2010 I got up too early this morning (that's my story and I'm sticking to it). thescientist, thanks for your time. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.