I wanted to put all the values of session in a variable named after the key so I came up with this code.
foreach($_SESSION as $key => $value){ $$key = $value; } For example I want used a session and saved a username on it using
$_SESSION['username'] = "Keith"; this means that I can use $username anytime. Now my problem is that how can I use all the information that the above code generates and use it inside a function like:
function get_content(){ echo $username; }
$$key = $_SESSIONshould be$$key = $value, otherwise each variable will get a copy of the entire session array.