如何将数组的所有值都放在变量中?

时间:2014-05-14 11:21:11

标签: php arrays

如何将数组的所有值都放在这样:

$array = array('0'=>'apple','1' => 'mango', '2' => 'orange'); 

$fruits = "apple,mango,orange";

请帮助我...... :(感谢之前:D

1 个答案:

答案 0 :(得分:1)

尝试使用implode:

<?php
$array = array('0'=>'apple','1' => 'mango', '2' => 'orange'); 
echo implode(",",$array);
?>