a simple clarification about $_SESSION

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Joseph S.

    a simple clarification about $_SESSION

    If I define
    $_SESSION['x']=5;

    and later, use $x say, as,

    $y = $x * $x;

    will it work only if register_global s is set to On?

    Am i correct in saying that usage of $x in place of $_SESSION['x'] will
    not work if register_global s is Off?

    TIA,
    Regards,
    Joseph S.

  • Toby Inkster

    #2
    Re: a simple clarification about $_SESSION

    Joseph S. wrote:
    [color=blue]
    > Am i correct in saying that usage of $x in place of $_SESSION['x'] will
    > not work if register_global s is Off?[/color]

    You are.

    Of course, you could just add this line to your code:

    $x = $_SESSION['x'];

    and then you can use $x in place of $_SESSION['x'].

    --
    Toby A Inkster BSc (Hons) ARCS
    Contact Me ~ http://tobyinkster.co.uk/contact

    Comment

    Working...