我试图从 csv 变量创建和数组:
$csv="one,two,tree,four";
$bits = split(',',$csv);
$elements = array();
for ($i=0;$i<count($bits);$i++)
{
$item .= '"'.$bits[$i].'"=>"'.$bits[$i].'",';
}
$item = substr($item, 0, -1);
$ara=array($item);
$USE['list'] = $ara;
我需要获得这样的东西,仅此而已:
$USE['list'] = array("one"=>"one","two"=>"two","tree"=>"tree","four"=>"four");