best way is to split the string with its delimiter (in your case the bar) then loop through each value. If the value is not true or false, store it in an array as the key (save this value) the next iterations (the true and false values) will be stored under this key so you'll have:
$array[robert] = array(true, true, false);
$array[arun] = array(true, false, true);
so on and so forth
next loop this array taking the key and values (hint: use a foreach with key and value extracted and use implode to glue the true/false values back together with a comma or whatever format you need it in.
PMed you the code I posted and got deleted by Atli.
I knew he's trying to prevent copy/paste solutions in the forum, but this was so simple that it was better to code it than explain it.
Besides, if you're at this point, you had had to know the basics of programming (arrays, loops, variables) to continue finishing the rest of the program.
Good luck,
Dan