Php foreach - separating each loop with comma except the last element

php

Solution

Try this:

echo implode(",<br/>", $array);

Problem

Heres what i mean: ``` foreach ($array as $a) { echo $a.',<br/>'; } ``` current output would be: ``` a, a, a, a, ``` i want the output to be like this: ``` a, a, a, a ``` (all 'a' separated with comma and when it comes to the last loop it doesnt write a comma)

Original source