3
如何從一個字符串中刪除整個字符,從一個特定的字符串位置開始到另一個位置,然後將剩下的字符移動到合併的起始位置?PHP substring delete
我正在處理HTML內容。舉個例子。
</a></h4><p class="pdesc">When a private satellite encounters .... and it is found to ...</p></div></div>.....<p class="pdesc">Before leavingon his .... </p> ...... <p class="pdesc"> .... </p>
所以現在我想刪除
之間<p class="pdesc"> - to - </p>.
每一次出現的
所有字符。
我可以搜索這個(strpos)並獲取起始位置和結束位置,但是之後手動刪除它們並從此開始移動字符串將太乏味了。
有沒有內置函數或簡單的方法來做到這一點?
http://php.net/manual/en/function.substr-replace.php – hakre 2011-12-26 19:24:56