问题描述
我确实这么认为,所以我编码:
$string = "date,name,age"; // csv file title order format
$tit = explode(",",$string); //array('date','name','age'); //will be called: $_date
//run PHP function to find a specific line
$arr = array('bash','monkey','badger'); //returned line
foreach ($tit as $i => $nam) {
$e = "_" . $nam;
$$e = $arr[$i];
}
//set variables contents as title name
echo $_name; //monkey
完美运行:Try it
function toList ($tit,$arr) {
foreach ($tit as $i => $nam) {
$e = "_" . $nam;
$$e = $arr[$i];
}
}
$tit = array('date','age'); //will be called as: $_date
$arr = array('bash','badger');
toList($tit,$arr);
echo $_date;
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)