views:

103

answers:

1

hi friends I have a php array for eg.

$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) .

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

+11  A: 

Just use implode function as:

echo implode(',',$mob_numbers);

explode is used to split a string to get an array

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

codaddict
... also known as `join` in other languages (in fact, PHP also has a `join()` alias for `implode()`)
NullUserException