我需要在每個數組值的開始處添加一個<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循環,如何我從第一個數組到第二個數組?
你的問題非常混亂,正是你想做的事? –