Thomas Lang
Thomas Lang

Reputation: 231

write variable array in one string

I have got an array with variable number of strings.

I need to write each element, separated with comma as one string in a variable.

With "foreach()" I got every element in a separate line.

Upvotes: 0

Views: 99

Answers (1)

t3chguy
t3chguy

Reputation: 1018

Use the snippet below:

implode(',', $array);

php.net-Docs

Upvotes: 4

Related Questions