Re: Re: Session Array 2 dimensions
| From: | Kevin Stone | Date: | Thu, 22 Aug 2002 22:17:43 +0000 |
| Subject: | Re: Re: Session Array 2 dimensions | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-113687@lists.php.net to get a copy of this message | ||
Your question was already answered but you didn't understand. The
$_SESSION
var works just like any other. There's absolutely nothing special
happening
except that anything set to the $_SESSION array is automatically stored in
the Session File on the server which you can call into other scripts with
session_start(); It seems that Sessions confuse a lot of people but
hopefully this make more sense now. :)
<? // page1.php
session_start();
$_SESSION[0][0] = 'Row 1: Column 1';
$_SESSION[1][0] = 'Row 2: Column 1';
$_SESSION[0][1] = 'Row 1: Column 2';
$_SESSION[1][1] = 'Row 2: Column 2';
echo '<p><a href="page2.php">- Loop Array -</a>';
?>
-------
<? // page2.php
session_start();
for($i=0; $i<count($_SESSION); $i++)
{
for ($j=0; $j<count($_SESSION[$i]); $j++)
{
echo $_SESSION[$i][$j]."<br>";
}
}
?>
Enjoy,
Kevin
> ----- Original Message -----
> From: "Christian Ista" <christian.ista@teledisnet.be>
> To: <php-general@lists.php.net>
> Sent: Thursday, August 22, 2002 2:50 PM
> Subject: [PHP] Re: Session Array 2 dimensions
>
>
> >
> > > You don't have to declare it - just use it:
> > > $my_array[10][500]="foo";
> >
> > I talk about a session array. ($_SESSION)
> >
> > Bye
> >
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
>