Today I have an interesting problem, where I need to take data stored in $_SESSION['form'][$key] and convert it to a local variable.
For example, lets say $_SESSION['form'] contains the following session keys:
$_SESSION['form']['name']
$_SESSION['form']['email']
$_SESSION['form']['age']
How can I convert these $_SESSION variables to:
$name
$email
$age
I was thinking that a for loop would work well for this, but I am not sure how to do that properly for this situation.
Thank you for your help!
$_SESSION['form']['name']in just the same way as$nameso are you sure you need to do this ?extract($_SESSION['form'])? (But be careful - read warnings)