我需要在每个数组值的开始处添加一个<p>
标记,并在每个数组值的末尾添加一个关闭</p>
标记。替换数组中的值
如果有[
或]
分隔符,然后他们需要与<p class="myclass">
Array
(
[0] => [This is a line of text
[1] => and another
[2] => and yet another.] [This is another line of text
[3] => and another
[4] => and another] [OK, so you get the idea.
)
代替上述阵列应该成为:
Array
(
[0] => <p class="myclass">This is a line of text</p>
[1] => <p>and another</p>
[2] => <p>and yet another.</p> <p class="myclass">This is another line of text</p>
[3] => <p>and another</p>
[4] => <p>and another</p> <p class="myclass">OK, so you get the idea.</p>
)
的问题是:使用foreach循环,如何我从第一个数组到第二个数组?
你的问题非常混乱,正是你想做的事? –