Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.php > #8764

Re: Will this set or get a SESSION variable?

From Christoph Becker <cmbecker69@gmx.de>
Newsgroups comp.lang.php
Subject Re: Will this set or get a SESSION variable?
Date 2013-03-20 23:53 +0100
Organization Aioe.org NNTP Server
Message-ID <kidekm$eiu$1@speranza.aioe.org> (permalink)
References <8dd22b72-62c3-4b3c-b3ec-10ff4d682614@e16g2000yqj.googlegroups.com>

Show all headers | View raw


David Heller wrote:

> I have the following code snippet:
> 
> 	if(in_array($name, $this->m_names))
> 		{
> 			$this->m_rules[$name][] = $rule;
> 			return $_SESSION[$name];
> 
> 		}
> In the entire script there does not appear to be any assignment to the
> $_SESSION super global
> so would it be fair to say that "return $_SESSION[$name];" not only
> creates a session variable but returns it also? And what is it set
> to?? It appears to me that $_SESSION[$name] = " " or possibly
> something else.

You may check it out for yourself:

	if(in_array($name, $this->m_names))
		{
			$this->m_rules[$name][] = $rule;
			var_dump($_SESSION[$name]);
			return $_SESSION[$name];

		}

If the session is not initialized or the session variable has not been
set before, it will print NULL.

You'll find comprehensive information about PHP sessions on
<http://www.php.net/manual/en/book.session.php>.

-- 
Christoph M. Becker

Back to comp.lang.php | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Will this set or get a SESSION variable? David Heller <daveh@allheller.net> - 2013-03-20 15:09 -0700
  Re: Will this set or get a SESSION variable? Christoph Becker <cmbecker69@gmx.de> - 2013-03-20 23:53 +0100
    Re: Will this set or get a SESSION variable? David Heller <daveh@allheller.net> - 2013-03-20 17:14 -0700
      Re: Will this set or get a SESSION variable? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-03-22 15:41 +0100
        Re: Will this set or get a SESSION variable? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-03-22 17:34 +0100
  Re: Will this set or get a SESSION variable? Robert Heller <heller@deepsoft.com> - 2013-03-20 18:39 -0500
    Re: Will this set or get a SESSION variable? Jerry Stuckle <jstucklex@attglobal.net> - 2013-03-20 23:35 -0400
  Re: Will this set or get a SESSION variable? Jerry Stuckle <jstucklex@attglobal.net> - 2013-03-20 23:32 -0400

csiph-web