如何一次性回显出php数组的所有元素?

时间:2020-12-17 01:14:01

hi friends I have a php array for eg.

朋友们,我有一个php数组,例如。

$mob_numbers= array(12345674, 12345675, 12345676,12345677);

I want to eacho out all of them at once so that it appears

我想立刻将所有这些同时出来以便它出现

12345674,12345675,12345676,12345677 (with comma) .

12345674,12345675,12345676,12345677(以逗号分隔)。

How do i do it ? I tried array explode, didn't work. Pls help

我该怎么做 ?我试过阵列爆炸,没有用。请帮忙

1 个解决方案

#1


19  

Just use implode function as:

只需使用implode函数:

echo implode(',',$mob_numbers);

explode is used to split a string to get an array

explode用于拆分字符串以获取数组

implode does the opposite of joining the array elements to get a string.

implode与加入数组元素以获取字符串相反。

#1


19  

Just use implode function as:

只需使用implode函数:

echo implode(',',$mob_numbers);

explode is used to split a string to get an array

explode用于拆分字符串以获取数组

implode does the opposite of joining the array elements to get a string.

implode与加入数组元素以获取字符串相反。