PDA

View Full Version : Seperating a string


paul41598
02-20-2007, 12:59 PM
Hey guys, I need just a tad bit of assistance here. I basically have a text field where you enter usernames seperated by comma's (Joe, Jeff, Craig) Thats where I use the explode function. Then use a foreach loop to loop through the names. However if I echo the $list_usernames it spits out JoeJeffCraig in one line. I actually need each name to be sperated with a ; and I'm having a brain lapse on how to do this again




$list_usernames = explode(",",$vbulletin->options['list_usernames']);

foreach($list_usernames AS $list_username)
{
need code here
}

Paul M
02-20-2007, 01:03 PM
echo $list_username . '; ' ;

paul41598
02-20-2007, 01:06 PM
that easy? oops, thought it required another function

My goal is to put the variable in the pm datamanager

$pmdm->set_recipients($list_username, $botpermissions);

So in the foreach maybe I need something like this?


foreach($list_usernames AS $list_username)
{
$listusernames = $list_username;;
}

$pmdm->set_recipients($listusernames, $botpermissions);





UPDATE:

Think I got it


foreach($list_usernames AS $list_username)
{
$listusernames .= '' . $list_username . ';';
}