Jump to content

[SOLVED] foreach question


izbryte

Recommended Posts

I have an array of items that I need to print out. I have it set so that there is a comma after each item.

Here's my current code:

$specialties=explode(",",$row['specialties']);				
foreach($specialties as $fs) {
echo "$fs, ";
}

 

Is there any way that I can remove that last comma?

 

Right now it looks like this

A, B, C, D, E,

I'd like it to look like this

A, B, C, D, E

 

Thanks in advance for any help!

Link to comment
https://forums.phpfreaks.com/topic/90124-solved-foreach-question/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.