note 94944 added to function.session-start
| From: | falkon303 at gmail dot com | Date: | Thu, 03 Dec 2009 20:49:47 +0000 |
| Subject: | note 94944 added to function.session-start | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-163550@lists.php.net to get a copy of this message | ||
I have found that you can use arrays with session variables in a very convenient manner. Be sure to
unset the array afterwards!
The following is an example.
<?php
session_start();
$sessionvars['name'] = "John";
$sessionvars['age'] = "43";
$sessionvars['gender'] = "Male";
$sessionvars['email'] = "jdoe3@gmail.com";
$_SESSION['arvars'] = $sessionvars;
unset($sessionvars);
echo $_SESSION['arvars']['name']."<br>";
echo $_SESSION['arvars']['age']."<br>";
echo $_SESSION['arvars']['gender']."<br>";
echo $_SESSION['arvars']['email']."<br>";
?>
----
Server IP: 69.147.83.197
Probable Submitter: 71.212.43.133
----
Manual Page -- http://www.php.net/manual/en/function.session-start.php
Edit -- https://master.php.net/note/edit/94944
Del: integrated -- https://master.php.net/note/delete/94944/integrated
Del: useless -- https://master.php.net/note/delete/94944/useless
Del: bad code -- https://master.php.net/note/delete/94944/bad+code
Del: spam -- https://master.php.net/note/delete/94944/spam
Del: non-english -- https://master.php.net/note/delete/94944/non-english
Del: in docs -- https://master.php.net/note/delete/94944/in+docs
Del: other reasons-- https://master.php.net/note/delete/94944
Reject -- https://master.php.net/note/reject/94944
Search -- https://master.php.net/manage/user-notes.php