帮我写两个php函数,初级的.$a=array('a','b','c','d','e','f');有这么个数组[第一个]________________________Array([a] => a[b] => b[c] => c[d] => d[e] => e[f] => f)[第二个]____________________________________$a='a';$b='b';$c='c';$d='d
来源:学生作业帮助网 编辑:作业帮 时间:2024/11/29 10:01:54
帮我写两个php函数,初级的.$a=array('a','b','c','d','e','f');有这么个数组[第一个]________________________Array([a] => a[b] => b[c] => c[d] => d[e] => e[f] => f)[第二个]____________________________________$a='a';$b='b';$c='c';$d='d
帮我写两个php函数,初级的.
$a=array('a','b','c','d','e','f');
有这么个数组
[第一个]________________________
Array
(
[a] => a
[b] => b
[c] => c
[d] => d
[e] => e
[f] => f
)
[第二个]____________________________________
$a='a';
$b='b';
$c='c';
$d='d';
$e='e';
$f='f';
帮我写结果这么两个的函数~
帮我写两个php函数,初级的.$a=array('a','b','c','d','e','f');有这么个数组[第一个]________________________Array([a] => a[b] => b[c] => c[d] => d[e] => e[f] => f)[第二个]____________________________________$a='a';$b='b';$c='c';$d='d
function rearr($arr = array())
{
if(count($arr) && is_array($arr))
{
foreach($arr as $key=>$val)
{
$new_arr[$val] = $val;
}
}
return $new_arr;
}
function golrearr($arr = array())
{
if(count($arr) && is_array($arr))
{
foreach($arr as $key=>$val)
{
$$val = $val;
}
}
return $$val;
}