Hi,
I' ve come across numerous situations where I want to print an array in a certain format, but I cannot do it. For instance, I have an array with the values "1", "2", and "3". I would like to print out "1, 2, 3". The problem I have is if I print the array like so:
foreach($array as $value)
{
echo $value.",";
}
I end up with an extra comma at the end, e.g., "1, 2, 3,". I know I could print each value separately, but this isn't very useful, especially when I have an array with a varying number of vlaues. Can anyone tell me a simple solution to this problem? I'm really trying to learn good coding techniques and this would be a good one to have.
Thanks!