Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
print_r($arraydata);
我得到了输出
数组( [0] => vikas [1] => 衬衫 [2] => 布料 1 [3] => 测试 [4] => 衬衫 [5] => 布料 2 [6] => avi)
我需要显示这样的数组
$arr = array("vikas","shirt","cloth1","test","shirt","cloth2","avi");
用这个 :
echo '$arr = array("'.implode('", "', $arraydata).'");';
如果需要逗号分隔:
echo '$arr = array('; foreach ($array as $key => $value) { if ($key > 0) echo ','; echo '"'.$value.'"'; } echo ');';