RE: [PHP] echo and Session Variables

From: Date: Thu, 21 Mar 2002 23:44:46 +0000
Subject: RE: [PHP] echo and Session Variables
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-89610@lists.php.net to get a copy of this message
The single quotes in $_SESSION['myvar'] are not necessary. You're reading an associative array in which a string is acting as a pointer to the index. Example.. $myarray = array ('myvar' => 'myvalue'); echo $myarray[myvar]; // prints out 'myvalue' -Kevin -----Original Message----- From: David Johansen [mailto:daveisfera@yahoo.com] Sent: Thursday, March 21, 2002 4:26 PM To: php-general@lists.php.net Subject: Re: [PHP] echo and Session Variables Thanks that fixed the problem, but I have a question then. Am I supposed to put the ' in the $_SESSION[] in the normal parts of code. Thanks, Dave "Miguel Cruz" <mnc@stoic.net> wrote in message news:Pine.LNX.4.44.0203211648020.7613-100000@stoic.net... > On Thu, 21 Mar 2002, David Johansen wrote: > > I was just wondering if there's a way to use echo with session variables. > > When I try to do this: > > > > <?php > > if (isset($_SESSION['x_Email'])) > > echo "value=\"$_SESSION['x_Email']\""; > > ?> > > The issue is with the syntax you're using to refer to arrays within double > quotes. > > echo "value=\"{$_SESSION[x_Email]}\""; > > miguel > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

« previous php.general (#89610) next »