0
我在我的配置文件中设置了一个数组,我在我的函数中使用了全局变量。
这工作正常,但现在我想在我的函数中将此数组的名称作为@参数传递。
变量中的PHP变量
// in config file:
$album_type_arr = array("appartamento", "villa");
global $album_type_arr; // pull in from db_config
echo $album_type_arr[0];
function buildmenu($name) {
$test = global $name . "_arr";
echo $test[0];
}
buildmenu("album_type");
你的问题是? – 2010-03-24 11:09:52
你不能直接将你的数组传递给你的函数吗? 'buildmenu($ album_type_arr);' – 2010-03-24 11:11:15
也许,但我需要这个名字的其他东西,值等tnx无论如何。 – FFish 2010-03-24 11:19:40