$linkler= "{";
foreach(explode("\n", $text) as $line) {
$linkler.= $line." | ";
}
$linkler.="}";
echo $linkler;