Hi,
I have an array which I would like to turn into a variable including the commas.
Now I know I can extract the array and put commas inbetween each part to simply output it on the screen using this:
for ($i=0; $i<count($sub_service); $i++)
{
echo $sub_service[$i];
if ($i == count($sub_service)-1)
{
echo "<BR><BR>";
}
else
{
echo ", ";
}
}
That works ok, but I want to turn the entire output of that for loop into a single variable that I can use within an echo.
How do I do that. Every time I call the array variable the output just says "Array" and doesn't show everything inside it.
Thanks alot!
Nate
I have an array which I would like to turn into a variable including the commas.
Now I know I can extract the array and put commas inbetween each part to simply output it on the screen using this:
for ($i=0; $i<count($sub_service); $i++)
{
echo $sub_service[$i];
if ($i == count($sub_service)-1)
{
echo "<BR><BR>";
}
else
{
echo ", ";
}
}
That works ok, but I want to turn the entire output of that for loop into a single variable that I can use within an echo.
How do I do that. Every time I call the array variable the output just says "Array" and doesn't show everything inside it.
Thanks alot!
Nate
