i have the array name in a string and i want to call that array in a function, but some how the $$array_name dose not work as array in the function even if you call the array name in the global statment of the function. so i have too same code of the calling array but one is function and second is non function, but i want function one to show the out as non function one. if you see the function one and non function as different output.
http_url to use for get array = "location page.php?sd=mySelf ";
function vars(){
global $_GET;
//array var
$var_name = "sd";
//array name
$array_name = "_GET";
// pass array to another string
$value = $$array_name;
// call array from second string and with orignal string.
echo $value[$var_name]."<br>".$_GET[sd]."<br>";
}
var(); // call function
//array var
$var_name = "sd";
//array name
$array_name = "_GET";
// pass array to another string
$value = $$array_name;
// call array from second string and with orignal string.
echo $value[$var_name]."<br>".$_GET[sd];
Output: Vars with the function.
mySelf
Output: Vars without the function.
mySelf
mySelf
any idea what is wronge with the function vars?