0

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.

2
  • 1
    possible duplicate of Convert array to string Commented Jul 22, 2014 at 13:39
  • 1
    please read the php docs and/or learn how to search.... Commented Jul 22, 2014 at 13:39

1 Answer 1

4

Use the snippet below:

implode(',', $array);

php.net-Docs

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.