$arr = array('id1','id2',...);
How to get #id1,#id2,.. from the above array?
$arr = array('id1', 'id2', ...);
$ids = '#' . join(',#', $arr);
echo $ids; // => #id1,#id2,...
'#' . join(',#', $arr);.implode though because it parallels explode. Since split is deprecated, it seems weird to me to use join and explode together.implode() too, I was just adding an emphasis on Doug comment. =)$arr[0];
$arr[1];
The code you just provided is the same as
$arr = array(
0 => "id1",
1 => "id2");
In order to make a list of ids in CSS
$string = '';
foreach($arr as $id)
{
$string .= "#" . $id . " ";
}