I'm can't seem to use variable variables to declare a variable GLOBAL. Is it even possible to do this. I have been able to successfully do this function if I make manually declare each variable GLOBAL, but that seems to create a lot of bloat in the code.
I'd also like to be able to use a variable variable to make the array GLOBAL in scope as I've only been successful using this function if I also make the array GLOBAL, even when the array is mentioned in the parameters of the function.
This is the code I've been working with.
$cart[qid] = 99;
$cart[qtxt]= "tex2";
$cart[ans1] = "text3";
$cart[ans2] = "text4 ";
$cart[ans3] = "text5";
$cart[ans4] = "text6 ";
$cart[ans5]="text7";
insert_info_into_session($cart,1);
FUNCTION insert_info_into_session($array_w_q_data,$num_of_cookie) {
GLOBAL ${$array_w_q_data};
GLOBAL $info_{$num_of_cookie};
$info_{$num_of_cookie} = serialize(${$array_w_q_data});
IF(session_register("$info_1")){
echo 'info_1 was successfully registered<P>';
};
#session_register ("info_${num_of_session}");
return;
};
Thanks for the help,
Bryan