如何使$ _SESSION ['something']并在它之前添加$以使其成为var。 它不起作用

Hi i need help with a thing. I defined a session var like so and when i tried to echo the $_SESSION['lang'] var it just didn't work at all. and of corse i had the page.php?lang=eng'

    $eng = "This is English. yey";
    if(empty($_GET['lang'])){
    $_SESSION['lang'] = $eng;
}else{
    $_SESSION['lang'] = "$" + $_GET['lang'];
}

i guess it was supposed to give me the var $eng, that i had defined and still nothing happened. Please help.

I can't see a very good reason for this but you want PHP: Variable variables:

$_SESSION['lang'] = ${$_GET['lang']};

This is a really bad idea. Variable variables are a good thing but NEVER initialize them from unescaped data. Right now pretty much anyone can set anything in $_SESSION['lang'] as a value.