Jump to content

Comma Problem!


Mr Nick

Recommended Posts

That's not exactly what I want to do :P. It's already outputting to "user1, user2, user3, " so the commas are already displaying. Just for the last part ("user3, "), I'd want the command removed and replaced with a period.

 

EDIT: The actual variable ( $user_fetch['username'] ) is the actual usernames. There is no comma in this.

Link to comment
https://forums.phpfreaks.com/topic/207538-comma-problem/#findComment-1085069
Share on other sites

That's not exactly what I want to do :P. It's already outputting to "user1, user2, user3, " so the commas are already displaying. Just for the last part ("user3, "), I'd want the command removed and replaced with a period.

 

EDIT: The actual variable ( $user_fetch['username'] ) is the actual usernames. There is no comma in this.

 

The way mjdamato has shown is the fairly standard way of doing this.  To add a period:

echo implode(',', $userList) . '.';

 

It's going to be a big hassle echoing each as you have shown.

 

 

Link to comment
https://forums.phpfreaks.com/topic/207538-comma-problem/#findComment-1085079
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.