php - Array & Session - Different between 'var' and $var -


I'm just trying to understand the PHP array.

What's between $ _ session ['var'] and $ _SESSION [$ var]?

And how and how can we use variables - $ _SESSION [$ var] like this [1]?

Thank you! : D

If you use $ var as an array index, $$ Value will be used index:

  $ var = "foo"; $ _SESSION ['foo'] = "bar"; $ _SESSION ['var'] = "variable"; Copy $ _SESSION ['var']; // This echo will "variable" $ _SESSION [$ var]; // This will repeat "bar"   

$ _SESSION [$ var] [1] string included in $ _SESSION [$ var] will be accessed as a second character array , Returns the letter 1 into the index - the second letter.

Comments