PHP 在文本区域的每一行的开头和结尾添加参数


PHP add param at the beginning and end of every line from textarea

我不太熟悉PHP,我需要创建一个函数来读取文本区域的每一行并添加一些字符串。

示例文本区域

AAA
BBB
CCC

我需要的是

somestringAAAotherstring
somestringBBBotherstring
somestringCCCotherstring

并在发送"帖子"后将其显示为输出。

编辑:

我的表格是

<FORM METHOD ="POST">
<textarea rows="30" name="content"></textarea>
<INPUT TYPE = "Submit" VALUE = "Send">
</FORM>

是的,问题是"怎么做?

$text = trim($_POST['textareaname']);
$textAr = explode("'n", $text);
$textAr = array_filter($textAr, 'trim'); // remove any extra 'r characters left behind
foreach ($textAr as $lines) {
    $line = $sometext . $lines . $someOtherText;
//proceed furthur
}