Re: Array in a $_session

From: Date: Tue, 17 Jun 2003 07:28:17 +0000
Subject: Re: Array in a $_session
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-151791@lists.php.net to get a copy of this message
On Tuesday 17 June 2003 14:48, fkeessen@planet.nl wrote: > Maybe you can make it a little bit clear for me? I can't because I don't know what you're trying to do. I can only point out what I see [to me] are obvious mistakes. > >You have not defined $i, so what did you expect to see here? > > > >> session_start(); > >> $aantalpers=$_SESSION["aantalpers"]; > >> $test1 = $_SESSION['test1'][$i]; > > So is it going to be: $test1[$i ]= $_SESSION['test1'][$i]; ??? A general rule: it is pointless (in most cases) to assign values from the superglobals (such as $_SESSION) to other variables. Just work with them directly. Trivial example: Instead of: $firstname = $_SESSION['firstname']; $lastname = $_SESSION['lastname']; echo "Hello $firstname $lastname"; Just do: echo "Hello {$_SESSION['firstname']} {$_SESSION['lastname']}"; -- Jason Wong -> Gremlins Associates -> www.gremlins.biz Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * ------------------------------------------ Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general ------------------------------------------ /* The only difference between a rut and a grave is their dimensions. */

« previous php.general (#151791) next »